Conditional Variable. More...
#include <rconditionvar.h>
Public Member Functions | |
RConditionVar (void) | |
void | Wait (RMutex *mutex, unsigned long time=0) |
void | Wait (unsigned long time=0) |
void | WakeUpOne (void) |
void | WakeUpAll (void) |
virtual | ~RConditionVar (void) |
Private Attributes | |
pthread_cond_t | Cond |
Detailed Description
Conditional Variable.
The RConditionVar class provides a representation of a conditional variable used for thread synchronization.
Lets suppose that a function func1 (of a given thread) is waiting that some kind of event occurs (for example in a func2 of a second thread). A conditional variable can be used to block to first thread as long as the event occurs.
Constructor & Destructor Documentation
RConditionVar | ( | void | ) |
Construct a conditional variable.
|
virtual |
Destruct the conditional variable.
Member Function Documentation
void Wait | ( | RMutex * | mutex, |
unsigned long | time = 0 |
||
) |
Wait that the conditional variable corresponds to a event.
- Parameters
-
mutex Mutex associated with the conditional variable. time Number of milliseconds to wait for the conditional variable. If null, the thread waits forever.
void Wait | ( | unsigned long | time = 0 | ) |
Wait that the conditional variable corresponds to a event.
- Parameters
-
time Number of milliseconds to wait for the conditional variable. If null, the thread waits forever.
void WakeUpOne | ( | void | ) |
Wake up one of the blocked thread by this conditional variable (depending of the priority schema).
void WakeUpAll | ( | void | ) |
Wake up all the blocked thread by this conditional vairbale.
Field Documentation
|
private |
The conditional variable structure.