#include <thread.h>
Inheritance diagram for ost::Conditional:

Public Methods | |
| Conditional () | |
| Create an instance of a conditional. | |
| virtual | ~Conditional () |
| Destroy the conditional. | |
| void | signal (bool broadcast) |
| Signal a conditional object and a waiting threads. | |
| void | wait (timeout_t timer=0) |
| Wait to be signaled from another thread. | |
Conditional variables may wait for and receive signals to notify when to resume or perform operations. Multiple waiting threads may be woken with a broadcast signal.
While this class inherits from Mutex, the methods of the class Conditional just handle the system conditional variable, so the user is responsible for calling enterMutex and leaveMutex so as to avoid race conditions. Another thing to note is that if you have several threads waiting on one condition, not uncommon in thread pools, each thread must take care to manually unlock the mutex if cancellation occurs. Otherwise the first thread cancelled will deadlock the rest of the thread.
|
|
Create an instance of a conditional.
|
|
|
Destroy the conditional.
|
|
|
Signal a conditional object and a waiting threads.
|
|
|
Wait to be signaled from another thread.
|
1.2.18