AtomicLong.GetAndAccumulate(Int64, ILongBinaryOperator) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
以原子方式更新(並以記憶體效應 VarHandle#compareAndSet指定)更新當前值,將給定函式應用於當前值與給定值的結果,回傳先前的值。
[Android.Runtime.Register("getAndAccumulate", "(JLjava/util/function/LongBinaryOperator;)J", "", ApiSince=24)]
public long GetAndAccumulate(long x, Java.Util.Functions.ILongBinaryOperator? accumulatorFunction);
[<Android.Runtime.Register("getAndAccumulate", "(JLjava/util/function/LongBinaryOperator;)J", "", ApiSince=24)>]
member this.GetAndAccumulate : int64 * Java.Util.Functions.ILongBinaryOperator -> int64
參數
- x
- Int64
更新值
- accumulatorFunction
- ILongBinaryOperator
兩個參數的無副作用函數
傳回
先前的數值
- 屬性
備註
以原子方式更新(並以記憶體效應 VarHandle#compareAndSet指定)更新當前值,將給定函式應用於當前值與給定值的結果,回傳先前的值。 此函式應無副作用,因為當嘗試更新因執行緒間爭用失敗時,可重新套用此功能。 函式以當前值作為第一個參數,並以該更新作為第二個參數套用。
新增於1.8版本。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。