StampedLock.IsLockStamp(Int64) 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.
Tells whether a stamp represents holding a lock.
[Android.Runtime.Register("isLockStamp", "(J)Z", "", ApiSince=33)]
public static bool IsLockStamp (long stamp);
[<Android.Runtime.Register("isLockStamp", "(J)Z", "", ApiSince=33)>]
static member IsLockStamp : 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 or write-lock operation
- Attributes
Remarks
Tells whether a stamp represents holding a lock. This method may be useful in conjunction with #tryConvertToReadLock
and #tryConvertToWriteLock
, for example:
{@code
long stamp = sl.tryOptimisticRead();
try {
...
stamp = sl.tryConvertToReadLock(stamp);
...
stamp = sl.tryConvertToWriteLock(stamp);
...
} finally {
if (StampedLock.isLockStamp(stamp))
sl.unlock(stamp);
}}
Added in 10.
Java documentation for java.util.concurrent.locks.StampedLock.isLockStamp(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.