共用方式為


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 屬性授權中所述的詞彙使用。

適用於