StampedLock.TryReadLock 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.
Overloads
TryReadLock() |
Non-exclusively acquires the lock if it is immediately available. |
TryReadLock(Int64, TimeUnit) |
Non-exclusively acquires the lock if it is available within the given time and the current thread has not been interrupted. |
TryReadLock()
Non-exclusively acquires the lock if it is immediately available.
[Android.Runtime.Register("tryReadLock", "()J", "GetTryReadLockHandler", ApiSince=24)]
public virtual long TryReadLock ();
[<Android.Runtime.Register("tryReadLock", "()J", "GetTryReadLockHandler", ApiSince=24)>]
abstract member TryReadLock : unit -> int64
override this.TryReadLock : unit -> int64
Returns
a read stamp that can be used to unlock or convert mode, or zero if the lock is not available
- Attributes
Remarks
Non-exclusively acquires the lock if it is immediately available.
Java documentation for java.util.concurrent.locks.StampedLock.tryReadLock()
.
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
TryReadLock(Int64, TimeUnit)
Non-exclusively acquires the lock if it is available within the given time and the current thread has not been interrupted.
[Android.Runtime.Register("tryReadLock", "(JLjava/util/concurrent/TimeUnit;)J", "GetTryReadLock_JLjava_util_concurrent_TimeUnit_Handler", ApiSince=24)]
public virtual long TryReadLock (long time, Java.Util.Concurrent.TimeUnit? unit);
[<Android.Runtime.Register("tryReadLock", "(JLjava/util/concurrent/TimeUnit;)J", "GetTryReadLock_JLjava_util_concurrent_TimeUnit_Handler", ApiSince=24)>]
abstract member TryReadLock : int64 * Java.Util.Concurrent.TimeUnit -> int64
override this.TryReadLock : int64 * Java.Util.Concurrent.TimeUnit -> int64
Parameters
- time
- Int64
the maximum time to wait for the lock
- unit
- TimeUnit
the time unit of the time
argument
Returns
a read stamp that can be used to unlock or convert mode, or zero if the lock is not available
- Attributes
Remarks
Non-exclusively acquires the lock if it is available within the given time and the current thread has not been interrupted. Behavior under timeout and interruption matches that specified for method Lock#tryLock(long,TimeUnit)
.
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.