StampedLock.IsWriteLockStamp(Int64) Method

Definition

Tells whether a stamp represents holding a lock exclusively.

[Android.Runtime.Register("isWriteLockStamp", "(J)Z", "", ApiSince=33)]
public static bool IsWriteLockStamp (long stamp);
[<Android.Runtime.Register("isWriteLockStamp", "(J)Z", "", ApiSince=33)>]
static member IsWriteLockStamp : int64 -> bool

Parameters

stamp
Int64

a stamp returned by a previous StampedLock operation

Returns

true if the stamp was returned by a successful write-lock operation

Attributes

Remarks

Tells whether a stamp represents holding a lock exclusively. This method may be useful in conjunction with #tryConvertToWriteLock, for example:

{@code
            long stamp = sl.tryOptimisticRead();
            try {
              ...
              stamp = sl.tryConvertToWriteLock(stamp);
              ...
            } finally {
              if (StampedLock.isWriteLockStamp(stamp))
                sl.unlockWrite(stamp);
            }}

Added in 10.

Java documentation for java.util.concurrent.locks.StampedLock.isWriteLockStamp(long).

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