語言

AtomicIntegerArray.GetAndUpdate(Int32, IIntUnaryOperator) 方法

定義

原子式更新(以記憶體效果指定) VarHandle#compareAndSet的元素 i ,根據所給函式的應用結果,回傳先前的值。

[Android.Runtime.Register("getAndUpdate", "(ILjava/util/function/IntUnaryOperator;)I", "", ApiSince=24)]
public int GetAndUpdate(int i, Java.Util.Functions.IIntUnaryOperator? updateFunction);
[<Android.Runtime.Register("getAndUpdate", "(ILjava/util/function/IntUnaryOperator;)I", "", ApiSince=24)>]
member this.GetAndUpdate : int * Java.Util.Functions.IIntUnaryOperator -> int

參數

i
Int32

指數

updateFunction
IIntUnaryOperator

一個無副作用函數

傳回

先前的數值

屬性

備註

原子式更新(以記憶體效果指定) VarHandle#compareAndSet的元素 i ,根據所給函式的應用結果,回傳先前的值。 此函式應無副作用,因為當嘗試更新因執行緒間爭用失敗時,可重新套用此功能。

新增於1.8版本。

java.util.concurrent.atomic.AtomicIntegerArray.getAndUpdate(int, java.util.function.IntUnaryOperator)Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於