#include <wefts_cond.h>
Inheritance diagram for Wefts::Cond:
Public Methods | |
virtual int | wait () |
Waits for the condition to be active. | |
virtual int | wait (long seconds, long nanoseconds) |
Waits for the condition to be active up to a certain time. | |
int | wait (double seconds) |
Waits for the condition to be active for a certain time. | |
virtual void | signal () |
Signals the condition. | |
Protected Methods | |
Cond () | |
Initializes the internal data of the condition. | |
~Cond () | |
Protected Attributes | |
pthread_cond_t | m_cond |
Internal condition variable. | |
pthread_mutex_t * | m_my_mutex |
Internal mutex. |
This condition class is meant to be overloaded by classes using specific mutex types. To use it, you have to create your own class using a combination of this class plus a fast or a reentrant mutex. This is implemented in the wtFastCondition and wtRCondition classes.
Subclassess must set my_my_mutex to a valid pthread mutex pointer
All condition classes are implemented via inline calls to maximize execution speed; also, their metods are extremely small.
|
Initializes the internal data of the condition. Initialization of m_my_mutex member is left to subclasses. |
|
|
|
Signals the condition. When a condition is signaled all the waiting threads are given a chance to go. |
|
Waits for the condition to be active for a certain time. Works as wait( long seconds, long nanoseconds), but the wait time can be expressed as a real number, 1.0 meaning a second.
|
|
Waits for the condition to be active up to a certain time. This method works as wait() but returns (with nonzero value) if a certain time has elapsed. If you call this function, you have to specify the amount of seconds and second fractions (expressed in nanoseconds) you want to wait for a single event to be risen. Granularity of the system greatly depends on underlying OS and process priviledges.
|
|
Waits for the condition to be active. This method waits forever or until stopped by an external event (signal).
|
|
Internal condition variable.
|
|
Internal mutex. Subclasses are invited to set this mutex to an initialized specific kind of mutex at creation. |