#include <Thread.h>
Public Member Functions | |
Condition () | |
Constructor. | |
virtual | ~Condition () |
Destructor. | |
bool | wait (int timeout=-1) |
Waits until the condition is satisfied (returns true) or there is a timeout (returns false). | |
void | notify () |
Notifies a change to one of the waiting threads. | |
void | notify_all () |
Notifies a change to all the waiting threads. | |
virtual bool | condition ()=0 |
Condition to be checked. | |
virtual void | exec () |
This is an optional function that is called before releasing the lock of the condition. | |
Private Attributes | |
pthread_cond_t | _cond |
a pthread condition that we are Wrapping |
This class encapsulates a condition, that is, it allows a thread to suspend execution until some condition is satisfied. The way to use it is calling its wait() method. When the condition is satisfied the class will notify it to the waiting threads.
This is an abstract class and the objects deriving from it should implement the condition() method.
virtual bool DAQpp::Condition::condition | ( | ) | [pure virtual] |
Condition to be checked.
This function should be overloaded and return true when the thread should wake up and false otherwise
Implemented in DAQpp::DAQmanager::RunManagerSet, DAQpp::DAQmanager::RunCondition, DAQpp::FIFO::DataCondition, and DAQpp::Monitor.
Referenced by wait().