This class is a c++ wrapper in order to use conditional variables. Conditional variables help to synchronize threads when there's a logical condition for the synchronization.
More...
#include <ConditionalVariable.h>
|
| ConditionalVariable () |
| constructor
- Exceptions
-
|
|
| ~ConditionalVariable () |
| destructor
|
|
void | signal () |
| This method sends a signal to the conditional variable telling it that the thread can continue
- Exceptions
-
|
|
void | signalAll () |
|
void | wait (const Mutex &mutex) const |
| This method waits until a signal arrives stopping the thread. The mutex passed by argument has to be locked before invoking this method. More...
|
|
bool | wait (const Mutex &mutex, std::time_t timeoutSec, std::time_t timeoutNanoSec) const |
| This method waits until a signal arrives or the timeout was hit. The mutex passed by argument has to be locked before invoking this method. More...
|
|
|
pthread_cond_t | condition_ |
| internal condition representation
|
|
This class is a c++ wrapper in order to use conditional variables. Conditional variables help to synchronize threads when there's a logical condition for the synchronization.
fesa::ConditionalVariable::ConditionalVariable |
( |
bool |
initialize | ) |
|
|
protected |
Constructor which can skip initialization of condition_.
- Parameters
-
initialize | the condition variable is initialized only if this is true. |
void fesa::ConditionalVariable::signalAll |
( |
| ) |
|
Signal all the threads waiting on this condition variable.
void fesa::ConditionalVariable::wait |
( |
const Mutex & |
mutex | ) |
const |
This method waits until a signal arrives stopping the thread. The mutex passed by argument has to be locked before invoking this method.
- Parameters
-
bool fesa::ConditionalVariable::wait |
( |
const Mutex & |
mutex, |
|
|
std::time_t |
timeoutSec, |
|
|
std::time_t |
timeoutNanoSec |
|
) |
| const |
This method waits until a signal arrives or the timeout was hit. The mutex passed by argument has to be locked before invoking this method.
- Parameters
-
mutex | to lock |
timeoutSec | - full seconds |
timeoutSec | - timeoutNanoSec |
- Returns
- true if timed out
The documentation for this class was generated from the following files:
- ConditionalVariable.h
- ConditionalVariable.cpp