語言

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。 錯誤回傳表示實際值不等於預期值。

屬性

備註

原子上將值設定為 newValue 當前值 == expectedValue,記憶體效果則由 指定 VarHandle#compareAndSet。

的 java.util.concurrent.atomic.AtomicLong.compareAndSet(long, long)Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於