AtomicInteger.CompareAndSet(Int32, Int32) 方法

定义

以原子方式将值设置为 newValue 如果当前值 == expectedValue,并指定 VarHandle#compareAndSet内存效果。

[Android.Runtime.Register("compareAndSet", "(II)Z", "")]
public bool CompareAndSet (int expectedValue, int newValue);
[<Android.Runtime.Register("compareAndSet", "(II)Z", "")>]
member this.CompareAndSet : int * int -> bool

参数

expectedValue
Int32

预期值

newValue
Int32

新值

返回

true 如果成功。 False 返回指示实际值不等于预期值。

属性

注解

以原子方式将值设置为 newValue 如果当前值 == expectedValue,并指定 VarHandle#compareAndSet内存效果。

适用于 . 的 java.util.concurrent.atomic.AtomicInteger.compareAndSet(int, int)Java 文档

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

适用于