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.

Constructors

this
this(EventLoop eventLoop, Lock lock)
Undocumented in source.

Members

Functions

acquire
bool acquire()

Acquire the underlying lock.

notify
void notify(size_t n)

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.

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
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