ReentrantReadWriteLock.ReentrantWriteLock.TryLock 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
| TryLock() |
Acquires the write lock only if it is not held by another thread at the time of invocation. |
| TryLock(Int64, TimeUnit) |
Acquires the write lock if it is not held by another thread within the given waiting time and the current thread has not been Interrupt(). |
TryLock()
Acquires the write lock only if it is not held by another thread at the time of invocation.
[Android.Runtime.Register("tryLock", "()Z", "GetTryLockHandler")]
public virtual bool TryLock ();
[<Android.Runtime.Register("tryLock", "()Z", "GetTryLockHandler")>]
abstract member TryLock : unit -> bool
override this.TryLock : unit -> bool
Returns
Implements
- Attributes
Remarks
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
TryLock(Int64, TimeUnit)
Acquires the write lock if it is not held by another thread within the given waiting time and the current thread has not been Interrupt().
[Android.Runtime.Register("tryLock", "(JLjava/util/concurrent/TimeUnit;)Z", "GetTryLock_JLjava_util_concurrent_TimeUnit_Handler")]
public virtual bool TryLock (long timeout, Java.Util.Concurrent.TimeUnit? unit);
[<Android.Runtime.Register("tryLock", "(JLjava/util/concurrent/TimeUnit;)Z", "GetTryLock_JLjava_util_concurrent_TimeUnit_Handler")>]
abstract member TryLock : int64 * Java.Util.Concurrent.TimeUnit -> bool
override this.TryLock : int64 * Java.Util.Concurrent.TimeUnit -> bool
Parameters
- timeout
- Int64
the time to wait for the write lock
- unit
- TimeUnit
the time unit of the timeout argument
Returns
Implements
- Attributes
Exceptions
if the current thread is interrupted
if the time unit is null
Remarks
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.