SGPthreadCond Class Reference

A condition variable is a synchronization device that allows threads to suspend execution until some predicate on shared data is satisfied. More...

#include <SGThread.hxx>

List of all members.

Public Member Functions

 SGPthreadCond ()
 Create a new condition variable.
 ~SGPthreadCond ()
 Destroy the condition object.
void wait (SGMutex &)
 Wait for this condition variable to be signaled.
bool wait (SGMutex &mutex, unsigned long ms)
 Wait for this condition variable to be signaled for at most 'ms' milliseconds.
void signal ()
 Wake one thread waiting on this condition variable.
void broadcast ()
 Wake all threads waiting on this condition variable.

Detailed Description

A condition variable is a synchronization device that allows threads to suspend execution until some predicate on shared data is satisfied.

A condition variable is always associated with a mutex to avoid race conditions.

Definition at line 250 of file SGThread.hxx.


Member Function Documentation

void SGPthreadCond::broadcast (  )  [inline]

Wake all threads waiting on this condition variable.

Nothing happens if no threads are waiting.

Definition at line 329 of file SGThread.hxx.

void SGPthreadCond::signal (  )  [inline]

Wake one thread waiting on this condition variable.

Nothing happens if no threads are waiting. If several threads are waiting exactly one thread is restarted. It is not specified which.

Definition at line 322 of file SGThread.hxx.

bool SGPthreadCond::wait ( SGMutex mutex,
unsigned long  ms 
)

Wait for this condition variable to be signaled for at most 'ms' milliseconds.

Parameters:
mutex reference to a locked mutex.
ms milliseconds to wait for a signal.
Returns:

Definition at line 86 of file SGThread.cxx.

void SGPthreadCond::wait ( SGMutex mutex  )  [inline]

Wait for this condition variable to be signaled.

Parameters:
SGMutex& reference to a locked mutex.

Definition at line 336 of file SGThread.hxx.


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

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1