Cond Class Reference

Conditional variable class. More...

#include <Thread.h>

List of all members.

Public Member Functions

 Cond ()
 Class constructor.
virtual ~Cond ()
 Class destructor.
bool lock ()
 Lock the thread mutex Aquire mutex lock for the thread.
void unlock ()
 Unlock the thread mutex Release the mutex lock for the thread.
void signal ()
 Signal a condition.
bool wait ()
 Wait for a condition.
bool wait (int ms)
 Wait for a condition, up to specified milliseconds.

Detailed Description

Conditional variable class.

Wraps a pthread mutex and conditional, use for advanced cases of conditional wait.


Constructor & Destructor Documentation

Cond::Cond (  ) 

Class constructor.

Initializes the condition variable object.

Cond::~Cond (  )  [virtual]

Class destructor.

Terminates the condition variable object. The mutex is unlocked before termination.


Member Function Documentation

bool Cond::lock (  ) 

Lock the thread mutex Aquire mutex lock for the thread.

Returns:
Returns true if locking was successful.
void Cond::signal (  ) 

Signal a condition.

Unblocks a thread that is blocked by condition variable. Mutex must be locked before calling signal(); unlock mutex afterwards.

bool Cond::wait ( int  ms  ) 

Wait for a condition, up to specified milliseconds.

Waits for a condition variable being signaled. Mutex must be locked before calling wait(); wait unlocks the mutex atomically while sleeping and re-locks after exiting from sleep; unlock mutex afterwards.

Parameters:
ms Number of milliseconds to wait
Returns:
Returns true if the thread timed wait call executed successfully.
bool Cond::wait (  ) 

Wait for a condition.

Waits for a condition variable being signaled. Mutex must be locked before calling wait(); wait unlocks the mutex atomically while sleeping and re-locks after exiting from sleep; unlock mutex afterwards.

Returns:
Returns true if the thread timed wait call executed successfully.

The documentation for this class was generated from the following files:
Generated on Wed Oct 20 11:13:43 2010 for libspatha by  doxygen 1.6.3