CondVar Class Reference

A condition variable -- a synchronization mechanism used to coordinate the actions of multiple threads. More...

#include <CondVar.h++>

List of all members.

Public Member Functions

 CondVar () throw ()
 Construct a new CondVar.
 ~CondVar () throw ()
 Destructor.
bool wait (Mutex &mutex, uint_t msec=FOREVER) throw ()
 Wait for the condition variable to be signalled.
void notify () throw ()
 Signal one of the threads that are waiting on this condition variable.
void notifyAll () throw ()
 Signal all threads that are waiting on this condition variable.

Static Public Attributes

static const uint_t FOREVER = 0
 A constant representing an infinite wait.


Detailed Description

A condition variable -- a synchronization mechanism used to coordinate the actions of multiple threads.

A condition variable is signalled to indicate that the state of some shared data has changed; one or more threads can wait on the condition variable for this change to occur.

Author:
Mark Lindner

Constructor & Destructor Documentation

CondVar (  )  throw ()

Construct a new CondVar.

~CondVar (  )  throw ()

Destructor.


Member Function Documentation

void notify (  )  throw ()

Signal one of the threads that are waiting on this condition variable.

If predictable scheduling behavior is required, the associated mutex should be held by the thread at the time that it calls this method.

void notifyAll (  )  throw ()

Signal all threads that are waiting on this condition variable.

If predictable scheduling behavior is required, the associated mutex should be held by the thread at the time that it calls this method.

bool wait ( Mutex mutex,
uint_t  msec = FOREVER 
) throw ()

Wait for the condition variable to be signalled.

The associated mutex should be held by the thread at the time that it calls this method.

Parameters:
mutex The mutex that is protecting the shared data; the mutex will be automatically released during the wait and reacquired when the wait completes.
msec The amount of time to wait, or FOREVER to wait indefinitely.
Returns:
true if the condition variable was signalled, false otherwise.


Member Data Documentation

const uint_t FOREVER = 0 [static]

A constant representing an infinite wait.


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

Generated on Sat Apr 17 23:03:08 2010 for libcommonc++ by  doxygen 1.5.9