AtomicLongArray.CompareAndExchange(Int32, Int64, Int64) 方法

定义

以原子方式将索引处 i 的元素设置为 newValue 元素的当前值(称为 <em>见证值</em>), == expectedValue内存效果由指定 VarHandle#compareAndExchange

[Android.Runtime.Register("compareAndExchange", "(IJJ)J", "", ApiSince=33)]
public long CompareAndExchange (int i, long expectedValue, long newValue);
[<Android.Runtime.Register("compareAndExchange", "(IJJ)J", "", ApiSince=33)>]
member this.CompareAndExchange : int * int64 * int64 -> int64

参数

i
Int32

索引

expectedValue
Int64

预期值

newValue
Int64

新值

返回

见证值,如果成功,则该值与预期值相同

属性

注解

以原子方式将索引处 i 的元素设置为 newValue 元素的当前值(称为 <em>见证值</em>), == expectedValue内存效果由指定 VarHandle#compareAndExchange

已在 9 中添加。

适用于 . 的 java.util.concurrent.atomic.AtomicLongArray.compareAndExchange(int, long, long)Java 文档

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

适用于