Share via


ReentrantLock.NewCondition Method

Definition

Returns a Condition instance for use with this Lock instance.

[Android.Runtime.Register("newCondition", "()Ljava/util/concurrent/locks/Condition;", "GetNewConditionHandler")]
public virtual Java.Util.Concurrent.Locks.ICondition? NewCondition ();
[<Android.Runtime.Register("newCondition", "()Ljava/util/concurrent/locks/Condition;", "GetNewConditionHandler")>]
abstract member NewCondition : unit -> Java.Util.Concurrent.Locks.ICondition
override this.NewCondition : unit -> Java.Util.Concurrent.Locks.ICondition

Returns

the Condition object

Implements

Attributes

Remarks

Returns a Condition instance for use with this Lock instance.

The returned Condition instance supports the same usages as do the Object monitor methods (Object#wait() wait, Object#notify notify, and Object#notifyAll notifyAll) when used with the built-in monitor lock.

<ul>

<li>If this lock is not held when any of the ConditionCondition#await() waiting or Condition#signal signalling methods are called, then an IllegalMonitorStateException is thrown.

<li>When the condition Condition#await() waiting methods are called the lock is released and, before they return, the lock is reacquired and the lock hold count restored to what it was when the method was called.

<li>If a thread is Thread#interrupt interrupted while waiting then the wait will terminate, an InterruptedException will be thrown, and the thread's interrupted status will be cleared.

<li>Waiting threads are signalled in FIFO order.

<li>The ordering of lock reacquisition for threads returning from waiting methods is the same as for threads initially acquiring the lock, which is in the default case not specified, but for <em>fair</em> locks favors those threads that have been waiting the longest.

</ul>

Java documentation for java.util.concurrent.locks.ReentrantLock.newCondition().

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