Class for creating a condition variable. More...
Public Member Functions | |
| ConditionVariable () noexcept | |
| Initialize a condition signaler. | |
| ~ConditionVariable () | |
| Release the condition signaler's resources. | |
| eError | signal (void) noexcept |
| Signal a waiting thread. | |
| eError | broadcast (void) noexcept |
| Signal all waiting threads. | |
| eError | wait (Mutex *pMutex, uint32_t uMilliseconds=UINT32_MAX) noexcept |
| Wait for a signal (With timeout) | |
Protected Attributes | |
| uint64_t | m_ConditionVariable [48/sizeof(uint64_t)] |
| Condition variable instance. | |
| uint_t | m_bInitialized |
| TRUE if the Condition variable instance successfully initialized | |
Private Member Functions | |
| ConditionVariable (const ConditionVariable &)=delete | |
| ConditionVariable & | operator= (const ConditionVariable &)=delete |
| ConditionVariable (ConditionVariable &&)=delete | |
| ConditionVariable & | operator= (ConditionVariable &&)=delete |
Class for creating a condition variable.
In a multiprocessor system, it's sometimes necessary to have a thread wait until an external condition has been satisfied. Once this class is created, the consumer thread will call Wait() with a locked Mutex and a timeout and it will halt until time has expired or another thread sends a signal to this class to alert the waiting thread that the stars are finally right and great Cthulhu can rise again.
Further reading http://en.wikipedia.org/wiki/Condition_variable#Condition_variables
|
privatedelete |
|
privatedelete |
|
noexcept |
| Burger::ConditionVariable::~ConditionVariable | ( | ) |
|
noexcept |
Signal all waiting threads.
If any threads are waiting for a signal, send a signal to all of them so they all may continue execution. If no thread is waiting, do nothing.
|
privatedelete |
|
privatedelete |
|
noexcept |
Signal a waiting thread.
If a thread is waiting for a signal, send a signal to the thread so it may continue execution. If no thread is waiting, do nothing.
|
noexcept |
Wait for a signal (With timeout)
Halt the thread until a signal is received or if a timeout has elapsed. If any threads are waiting for a signal, send a signal to all of them so they all may continue execution. If no thread is waiting, do nothing.
| pMutex | Pointer to a Mutex to use with this object |
| uMilliseconds | UINT32_MAX to wait forever, 0 for non-blocking |
|
protected |
TRUE if the Condition variable instance successfully initialized
|
protected |
Condition variable instance.