AtomicInteger.UpdateAndGet(IIntUnaryOperator) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
以原子方式更新(由指定的 VarHandle#compareAndSet内存效果)当前值,其结果为应用给定函数,并返回更新的值。
[Android.Runtime.Register("updateAndGet", "(Ljava/util/function/IntUnaryOperator;)I", "", ApiSince=24)]
public int UpdateAndGet(Java.Util.Functions.IIntUnaryOperator? updateFunction);
[<Android.Runtime.Register("updateAndGet", "(Ljava/util/function/IntUnaryOperator;)I", "", ApiSince=24)>]
member this.UpdateAndGet : Java.Util.Functions.IIntUnaryOperator -> int
参数
- updateFunction
- IIntUnaryOperator
无副作用函数
返回
更新的值
- 属性
注解
以原子方式更新(由指定的 VarHandle#compareAndSet内存效果)当前值,其结果为应用给定函数,并返回更新的值。 该函数应无副作用,因为当尝试更新因线程之间的争用而失败时,可能会重新应用该函数。
已在 1.8 中添加。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。