Condition

This class implements condition variable objects.

A condition variable allows one or more coroutines to wait until they are notified by another coroutine.

If the lock argument is given and not $(D_KEYWORD null) then it is used as the underlying lock. Otherwise, a new Lock object is created and used as the underlying lock.

This class is not thread safe.

Members

Functions

acquire
bool acquire()

Acquire the underlying lock.

notify
void notify(size_t n = 1)

By default, wake up one coroutine waiting on this condition, if any. If the calling coroutine has not acquired the lock when this method is called, an $(D_PSYMBOL Exception) is thrown.

notifyAll
void notifyAll()

Wake up all coroutines waiting on this condition. This method acts like $(D_PSYMBOL notify()), but wakes up all waiting coroutines instead of one. If the calling coroutine has not acquired the lock when this method is called, an $(D_PSYMBOL Exception) is thrown.

release
void release()

Release the underlying lock.

wait
bool wait()

Wait until notified.

waitFor
bool waitFor(bool delegate() predicate)

Wait until a predicate becomes true.

Properties

locked
bool locked [@property getter]

Return $(D_KEYWORD true) if the underlying lock is acquired.

Meta