utl::ConditionVar Class Reference
[Threads and Synchronization]

Condition variable. More...

#include <ConditionVar.h>

Inheritance diagram for utl::ConditionVar:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void broadcast ()
 Wake up all waiting threads.
void signal ()
 Wake up a single waiting thread.
void wait ()
 Atomically unlock the mutex and wait for the predicate to be satisfied.
void lockMutex ()
 Lock the associated Mutex.
void unlockMutex ()
 Unlock the associated Mutex.


Detailed Description

Condition variable.

ConditionVar is a synchronization device that allows a thread to block until a predicate is satisfied. It has an associated Mutex which is used to prevent the race condition where one thread calls wait() while another thread simultaneously calls broadcast() or signal(). If all threads always acquire the mutex before signaling the condition, this guarantees that the condition cannot be signaled (and thus ignored) between the time a thread locks the mutex and the time it waits on the condition variable.

Author:
Adam Mckee

Definition at line 38 of file ConditionVar.h.


Member Function Documentation

void utl::ConditionVar::broadcast (  ) 

Wake up all waiting threads.

void utl::ConditionVar::signal (  ) 

Wake up a single waiting thread.

void utl::ConditionVar::lockMutex (  ) 

Lock the associated Mutex.

void utl::ConditionVar::unlockMutex (  ) 

Unlock the associated Mutex.


The documentation for this class was generated from the following file:

Generated on Tue May 26 16:53:32 2009 for libUTL++ by  doxygen 1.5.6