VarHandle.WeakCompareAndSetAcquire(Object[]) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Possibly atomically sets the value of a variable to the newValue with the semantics of set(java.lang.Object...) if the variable's current value, referred to as the witness value, == the expectedValue, as accessed with the memory semantics of getAcquire(java.lang.Object...).
[Android.Runtime.Register("weakCompareAndSetAcquire", "([Ljava/lang/Object;)Z", "", ApiSince=33)]
public bool WeakCompareAndSetAcquire(params Java.Lang.Object[]? args);
[<Android.Runtime.Register("weakCompareAndSetAcquire", "([Ljava/lang/Object;)Z", "", ApiSince=33)>]
member this.WeakCompareAndSetAcquire : Java.Lang.Object[] -> bool
Parameters
- args
- Object[]
the signature-polymorphic parameter list of the form (CT1 ct1,..., CTn ctn, T expectedValue, T newValue), statically represented using varargs.
Returns
This method does not return a value. A JNI call to an access mode method throws an exception.
- Attributes
Remarks
This managed method calls the Java access mode method through JNI. The Java VarHandle documentation states that a JNI call to an access mode method ignores its argument and throws UnsupportedOperationException. Thus, this method does not do the access that the next paragraph describes.
Possibly atomically sets the value of a variable to the newValue with the semantics of set(java.lang.Object...) if the variable's current value, referred to as the witness value, == the expectedValue, as accessed with the memory semantics of getAcquire(java.lang.Object...). This operation may fail spuriously (typically, due to memory contention) even if the witness value does match the expected value. The method signature is of the form (CT1 ct1,..., CTn ctn, T expectedValue, T newValue)boolean. The symbolic type descriptor at the call site of weakCompareAndSetAcquire must match the access mode type that is the result of calling accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE) on this VarHandle.
Java reference for java.lang.invoke.VarHandle.weakCompareAndSetAcquire.