語言

AtomicIntegerArray.CompareAndSet(Int32, Int32, Int32) 方法

定義

原子式地將索引 i 中的元素設為, newValue 若該元素的當前值 == expectedValue為 ,則記憶效果由 VarHandle#compareAndSet指定。

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

參數

i
Int32

指數

expectedValue
Int32

期望值

newValue
Int32

新值

傳回

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

屬性

備註

原子式地將索引 i 中的元素設為, newValue 若該元素的當前值 == expectedValue為 ,則記憶效果由 VarHandle#compareAndSet指定。

Java 文件 java.util.concurrent.atomic.AtomicIntegerArray.compareAndSet(int, int, int)

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於