語言

AtomicLongArray.GetAndAccumulate(Int32, Int64, ILongBinaryOperator) 方法

定義

原子式更新(以記憶體效應指定) VarHandle#compareAndSet的元素 i ,將該函數套用於當前與給定值的結果,回傳先前的值。

[Android.Runtime.Register("getAndAccumulate", "(IJLjava/util/function/LongBinaryOperator;)J", "", ApiSince=24)]
public long GetAndAccumulate(int i, long x, Java.Util.Functions.ILongBinaryOperator? accumulatorFunction);
[<Android.Runtime.Register("getAndAccumulate", "(IJLjava/util/function/LongBinaryOperator;)J", "", ApiSince=24)>]
member this.GetAndAccumulate : int * int64 * Java.Util.Functions.ILongBinaryOperator -> int64

參數

i
Int32

指數

x
Int64

更新值

accumulatorFunction
ILongBinaryOperator

兩個參數的無副作用函數

傳回

先前的數值

屬性

備註

原子式更新(以記憶體效應指定) VarHandle#compareAndSet的元素 i ,將該函數套用於當前與給定值的結果,回傳先前的值。 此函式應無副作用,因為當嘗試更新因執行緒間爭用失敗時,可重新套用此功能。 函式的第一個參數是索引元素的當前值 i ,第二個參數是給定的更新值。

新增於1.8版本。

Java 文件 java.util.concurrent.atomic.AtomicLongArray.getAndAccumulate(int, long, java.util.function.LongBinaryOperator)

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於