AtomicLong.CompareAndSet(Int64, Int64) 方法

定义

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

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

参数

expectedValue
Int64

预期值

newValue
Int64

新值

返回

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

属性

注解

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

Java文档java.util.concurrent.atomic.AtomicLong.compareAndSet(long, long)

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于