StampedLock.IsReadLockStamp(Int64) Method

Definition

Tells whether a stamp represents holding a lock non-exclusively.

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

Parameters

stamp
Int64

a stamp returned by a previous StampedLock operation

Returns

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

Attributes

Remarks

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

{@code
            long stamp = sl.tryOptimisticRead();
            try {
              ...
              stamp = sl.tryConvertToReadLock(stamp);
              ...
            } finally {
              if (StampedLock.isReadLockStamp(stamp))
                sl.unlockRead(stamp);
            }}

Added in 10.

Java documentation for java.util.concurrent.locks.StampedLock.isReadLockStamp(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