AtomicStampedReference.AttemptStamp(Object, Int32) Method

Definition

Atomically sets the value of the stamp to the given update value if the current reference is == to the expected reference.

[Android.Runtime.Register("attemptStamp", "(Ljava/lang/Object;I)Z", "GetAttemptStamp_Ljava_lang_Object_IHandler")]
public virtual bool AttemptStamp (Java.Lang.Object? expectedReference, int newStamp);
[<Android.Runtime.Register("attemptStamp", "(Ljava/lang/Object;I)Z", "GetAttemptStamp_Ljava_lang_Object_IHandler")>]
abstract member AttemptStamp : Java.Lang.Object * int -> bool
override this.AttemptStamp : Java.Lang.Object * int -> bool

Parameters

expectedReference
Object

the expected value of the reference

newStamp
Int32

the new value for the stamp

Returns

true if successful

Attributes

Remarks

Atomically sets the value of the stamp to the given update value if the current reference is == to the expected reference. Any given invocation of this operation may fail (return false) spuriously, but repeated invocation when the current value holds the expected value and no other thread is also attempting to set the value will eventually succeed.

Java documentation for java.util.concurrent.atomic.AtomicStampedReference.attemptStamp(V, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to