다음을 통해 공유


StampedLock.TryConvertToWriteLock(Int64) Method

Definition

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

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

Parameters

stamp
Int64

a stamp

Returns

a valid write 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, returns it. Or, if a read lock, if the write lock is available, releases the read lock and returns a write stamp. Or, if an optimistic read, returns a write stamp only if immediately available. This method returns zero in all other cases.

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