#include <CCondVar.h>
Inherited by CCondVar< T >, and CCondVar< bool >.
Inheritance diagram for CCondVarBase:
Public Member Functions | |
CCondVarBase (CMutex *mutex) | |
manipulators | |
void | lock () const |
Lock the condition variable's mutex. | |
void | unlock () const |
Unlock the condition variable's mutex. | |
void | signal () |
Signal the condition variable. | |
void | broadcast () |
Signal the condition variable. | |
accessors | |
bool | wait (double timeout=-1.0) const |
Wait on the condition variable. | |
bool | wait (CStopwatch &timer, double timeout) const |
Wait on the condition variable. | |
CMutex * | getMutex () const |
Get the mutex. |
This class provides functionality common to all condition variables but doesn't provide the actual variable storage. A condition variable is a multiprocessing primitive that can be waited on. Every condition variable has an associated mutex.
Definition at line 30 of file CCondVar.h.
|
Definition at line 23 of file CCondVar.cpp. |
|
Signal the condition variable. Wake up all waiting threads, if any. Definition at line 54 of file CCondVar.cpp. |
|
Get the mutex. Get the mutex passed to the c'tor. Definition at line 78 of file CCondVar.cpp. |
|
Lock the condition variable's mutex. Lock the condition variable's mutex. The condition variable should be locked before reading or writing it. It must be locked for a call to wait(). Locks are not recursive; locking a locked mutex will deadlock the thread. Definition at line 36 of file CCondVar.cpp. References CMutex::lock(). |
|
Signal the condition variable. Wake up one waiting thread, if there are any. Which thread gets woken is undefined. Definition at line 48 of file CCondVar.cpp. |
|
Wait on the condition variable.
Same as (cancellation point) Definition at line 60 of file CCondVar.cpp. References CStopwatch::getTime(), and wait(). |
|
Wait on the condition variable.
Wait on the condition variable. If The proper way to wait for a condition is: cv.lock();
while (cv-expr) {
cv.wait();
}
cv.unlock();
cv-expr involves the value of cv and is false when the condition is satisfied.(cancellation point) Definition at line 72 of file CCondVar.cpp. References CMutex::m_mutex. Referenced by CTCPSocket::flush(), and wait(). |