miosix::ConditionVariable Class Reference
[Syncronization]

#include <sync.h>

List of all members.

Public Member Functions

 ConditionVariable ()
void wait (Lock &l)
void wait (Mutex &m)
void signal ()
void broadcast ()


Detailed Description

A condition variable class for thread synchronization, available from Miosix 1.53.
One or more threads can wait on the condition variable, and the signal() and broadcast() llow to wake ne or all the waiting threads.
This class is meant to be a static or global class. Dynamically creating a ConditionVariable with new or on the stack must be done with care, to avoid deleting a ConditionVariable while some threads are waiting, and to avoid situations where a thread tries to wait on a deleted ConditionVariable.

Constructor & Destructor Documentation

miosix::ConditionVariable::ConditionVariable (  ) 

Constructor, initializes the ConditionVariable.


Member Function Documentation

void miosix::ConditionVariable::broadcast (  ) 

Wakeup all waiting threads.

void miosix::ConditionVariable::signal (  ) 

Wakeup one waiting thread. Currently implemented policy is fifo.

void miosix::ConditionVariable::wait ( Mutex m  )  [inline]

Unlock the mutex and wait. If more threads call wait() they must do so specifying the same mutex, otherwise the behaviour is undefined.

Parameters:
m A locked Mutex

void miosix::ConditionVariable::wait ( Lock l  )  [inline]

Unlock the mutex and wait. If more threads call wait() they must do so specifying the same mutex, otherwise the behaviour is undefined.

Parameters:
l A Lock instance that locked a Mutex


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

Generated on Mon Aug 30 00:05:00 2010 for Miosix by  doxygen 1.5.9