Java.Util.Concurrent.Locks.ReentrantLock.LockInterruptibly Method
Acquires the lock unless the current thread is Java.Lang.Thread.Interrupt.

Syntax

[Android.Runtime.Register("lockInterruptibly", "()V", "GetLockInterruptiblyHandler")]
public virtual void LockInterruptibly ()

Exceptions

TypeReason
Java.Lang.InterruptedExceptionif the current thread is interrupted

Remarks

Acquires the lock unless the current thread is Java.Lang.Thread.Interrupt.

Acquires the lock if it is not held by another thread and returns immediately, setting the lock hold count to one.

If the current thread already holds this lock then the hold count is incremented by one and the method returns immediately.

If the 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:

If the lock is acquired by the current thread then the lock hold count is set to one.

If the current thread:

then Java.Lang.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.

[Android Documentation]

Requirements

Namespace: Java.Util.Concurrent.Locks
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1