SourceForge.net Logo

DAQpp::Condition Class Reference

class Condition. More...

#include <Thread.h>

Inheritance diagram for DAQpp::Condition:

Inheritance graph
[legend]
Collaboration diagram for DAQpp::Condition:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

class Condition.

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.


Member Function Documentation

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().


The documentation for this class was generated from the following files:

Generated on Mon Apr 21 10:00:05 2008 for DAQ++ by  doxygen 1.5.5