語言

AtomicBoolean.CompareAndSet(Boolean, Boolean) 方法

定義

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

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

參數

expectedValue
Boolean

期望值

newValue
Boolean

新值

傳回

如果成功,則為 true。 錯誤回傳表示實際值不等於預期值。

屬性

備註

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

java.util.concurrent.atomic.AtomicBoolean.compareAndSet(boolean, boolean)Java 檔。

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

適用於