Sdílet prostřednictvím


StampedLock.TryConvertToReadLock(Int64) Method

Definition

If the lock state matches the given stamp, atomically performs one of the following actions.

[Android.Runtime.Register("tryConvertToReadLock", "(J)J", "GetTryConvertToReadLock_JHandler", ApiSince=24)]
public virtual long TryConvertToReadLock (long stamp);
[<Android.Runtime.Register("tryConvertToReadLock", "(J)J", "GetTryConvertToReadLock_JHandler", ApiSince=24)>]
abstract member TryConvertToReadLock : int64 -> int64
override this.TryConvertToReadLock : int64 -> int64

Parameters

stamp
Int64

a stamp

Returns

a valid read stamp, or zero on failure

Attributes

Remarks

If the lock state matches the given stamp, atomically performs one of the following actions. If the stamp represents holding a write lock, releases it and obtains a read lock. Or, if a read lock, returns it. Or, if an optimistic read, acquires a read lock and returns a read stamp only if immediately available. This method returns zero in all other cases.

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