Class 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 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.

Inherits from

  • Object (base class)

Properties

Name Type Description
locked [get] bool Return true if the underlying lock is acquired.

Methods

Name Description
acquire Acquire the underlying lock.
notify 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 Exception is thrown.
notifyAll Wake up all coroutines waiting on this condition. This method acts like 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 Exception is thrown.
release Release the underlying lock.
wait Wait until notified.
waitFor Wait until a predicate becomes true.

Authors

Dragos Carp

Copyright

© 2015-2016 Dragos Carp

License

Boost Software License - Version 1.0