AtomicLong.AccumulateAndGet(Int64, ILongBinaryOperator) 方法

定义

以原子方式更新(由指定的 VarHandle#compareAndSet内存效果)当前值,并将给定函数应用于当前值和给定值的结果,并返回更新的值。

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

参数

x
Int64

更新值

accumulatorFunction
ILongBinaryOperator

两个参数的无副作用函数

返回

更新的值

属性

注解

以原子方式更新(由指定的 VarHandle#compareAndSet内存效果)当前值,并将给定函数应用于当前值和给定值的结果,并返回更新的值。 该函数应无副作用,因为当尝试更新因线程之间的争用而失败时,可能会重新应用该函数。 该函数应用当前值作为第一个参数,将给定更新作为第二个参数。

已在 1.8 中添加。

适用于 . 的 java.util.concurrent.atomic.AtomicLong.accumulateAndGet(long, java.util.function.LongBinaryOperator)Java 文档

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于