#include <condition.hh>
Inheritance diagram for mpcl::system::ICondition:
Public Methods | |
virtual | ~ICondition (void) |
Destroys the instance. | |
virtual void | wait (void)=0 |
virtual bool | timedWait (size_t zSECONDS, size_t zNANOSECONDS=0)=0 |
virtual void | signal (void)=0 |
virtual void | broadcast (void)=0 |
A condition (short for "condition variable") is a synchronization device that allows threads to suspend execution and relinquish the processors until some predicate on shared data is satisfied. The basic operations on conditions are: signal the condition (when the predicate becomes true), and wait for the condition, suspending the thread execution until another thread signals the condition.
A condition variable must always be associated with a mutex, to avoid the race condition where a thread prepares to wait on a condition variable and another thread signals the condition just before the first thread actually waits on it.
Definition at line 57 of file condition.hh.
|
Restarts all the threads that are waiting on this condition variable. Nothing happens if no threads are waiting on this. Implemented in mpcl::system::TCondition. |
|
Restarts one of the threads that are waiting on this condition variable If no threads are waiting on this, nothing happens. If several threads are waiting on this, exactly one is restarted, but it is not specified which. Implemented in mpcl::system::TCondition. |
|
Atomically unlocks the related mutex and waits on this variable, as wait() does, but it also bounds the duration of the wait. If this condition has not been signaled within the amount of time specified in parameters, the former mutex is re-acquired and returns true. In any case the thread will re-acquire the externally supplied mutex.
Implemented in mpcl::system::TCondition. |
|
Atomically unlocks the associated mutex (as per member function TBaseMutex::unlock()) and waits for this condition variable to be signaled. The thread execution is suspended and does not consume any CPU time until this condition variable is signaled. That mutex must be locked by the calling thread on entrance to this member function. Before returning to the calling thread, this member function re-acquires mutex (as per member function TBaseMutex::lock()). This member function seems like is prefixed with a TBaseMutex::unlock() and postfixed with a TBaseMutex::lock() over the related mutex.
Implemented in mpcl::system::TCondition. |