VCF::Condition Class Reference
The Condition object is used as a synchronization primitive, like the Mutex, and Semaphore. More...
#include <vcf/FoundationKit/Condition.h>
Inheritance diagram for VCF::Condition:

Public Member Functions | |
| Condition (Mutex *mutex) | |
| Every condtion must be associated with a mutex. | |
| virtual | ~Condition () |
| void | signal () |
| Signal one waiting thread that condition is true. | |
| virtual void | broadcast () |
| ConditionPeer * | getPeer () |
| virtual Waitable::WaitResult | wait () |
| Wait forever until the condition is signaled. | |
| Waitable::WaitResult | wait (uint32 milliseconds) |
| Wait for a maximum number of milliseconds until the condition is signaled. | |
| OSHandleID | getPeerHandleID () |
| Mutex * | getMutex () |
| Returns the mutex associated with the condition. | |
Protected Attributes | |
| Mutex * | mutex_ |
| ConditionPeer * | peer_ |
Detailed Description
The Condition object is used as a synchronization primitive, like the Mutex, and Semaphore.While the Mutex and Semaphore can cause multiple threads to block, waiting for the mutex or semaphore to become signaled, only one thread will every wake at any given moment. In contrast, a Condition can be used to wake up a series of threads all waiting on the condition.
The Condition class follows the same pattern that the Pthreads condition variable uses, or the Boost condition class. In fact, the Win32 implementation is written largely based of off the excellent code in the Boost condition class that was written by William Kempf.
Constructor & Destructor Documentation
|
|
Every condtion must be associated with a mutex.
|
|
|
|
Member Function Documentation
|
|
|
|
|
Returns the mutex associated with the condition.
|
|
|
|
|
|
Implements VCF::Waitable. |
|
|
Signal one waiting thread that condition is true.
|
|
|
Wait for a maximum number of milliseconds until the condition is signaled. The thread that calls this will block till the condition is signaled. If the condition is signaled before the timeout period is ellapsed the function will return Waitable::wrTimeout value. Implements VCF::Waitable. |
|
|
Wait forever until the condition is signaled. The thread that calls this will block till the condition is signaled. If the wait fails the method will return Waitable::wrFail Implements VCF::Waitable. |
Member Data Documentation
|
|
|
|
|
|
The documentation for this class was generated from the following file:
- vcf/FoundationKit/Condition.h
