ReentrantReadWriteLock.ReentrantReadLock.LockInterruptibly Method

Definition

Acquires the read lock unless the current thread is Thread#interrupt interrupted.

[Android.Runtime.Register("lockInterruptibly", "()V", "GetLockInterruptiblyHandler")]
public virtual void LockInterruptibly ();
[<Android.Runtime.Register("lockInterruptibly", "()V", "GetLockInterruptiblyHandler")>]
abstract member LockInterruptibly : unit -> unit
override this.LockInterruptibly : unit -> unit

Implements

Attributes

Exceptions

if the current thread is interrupted

Remarks

Acquires the read lock unless the current thread is Thread#interrupt interrupted.

Acquires the read lock if the write lock is not held by another thread and returns immediately.

If the write lock is held by another thread then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:

<ul>

<li>The read lock is acquired by the current thread; or

<li>Some other thread Thread#interrupt interrupts the current thread.

</ul>

If the current thread:

<ul>

<li>has its interrupted status set on entry to this method; or

<li>is Thread#interrupt interrupted while acquiring the read lock,

</ul>

then InterruptedException is thrown and the current thread's interrupted status is cleared.

In this implementation, as this method is an explicit interruption point, preference is given to responding to the interrupt over normal or reentrant acquisition of the lock.

Java documentation for java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lockInterruptibly().

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