語言

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

定義

若元素的當前值== expectedValue為 ,則可能原子性地將該元素i的索引設為 ,newValue並有記憶體效應,由 所指定VarHandle#weakCompareAndSetPlain

[Android.Runtime.Register("weakCompareAndSet", "(IJJ)Z", "")]
public bool WeakCompareAndSet(int i, long expectedValue, long newValue);
[<Android.Runtime.Register("weakCompareAndSet", "(IJJ)Z", "")>]
member this.WeakCompareAndSet : int * int64 * int64 -> bool

參數

i
Int32

指數

expectedValue
Int64

期望值

newValue
Int64

新值

傳回

true 若成功

屬性

備註

若元素的當前值== expectedValue為 ,則可能原子性地將該元素i的索引設為 ,newValue並有記憶體效應,由 所指定VarHandle#weakCompareAndSetPlain

此會員已被棄用。 此方法具有純粹的記憶體效應,但其名稱暗示揮發性記憶體效應(參見如 #compareAndExchange#compareAndSet等方法)。 為避免對純記憶或揮發性記憶效應產生混淆,建議採用此方法 #weakCompareAndSetPlain

Java 文件 java.util.concurrent.atomic.AtomicLongArray.weakCompareAndSet(int, long, long)

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

適用於