H3D::ConditionLock Class Reference

The ConditionLock is a little more advanced version of MutexLock in that it can wait for an arbitrary action in the other thread. More...

#include <Threads.h>

Inheritance diagram for H3D::ConditionLock:

Inheritance graph
List of all members.

Public Member Functions

 ConditionLock ()
 Constructor.
 ~ConditionLock ()
 Destructor.
void wait ()
 Wait for the conditional to get a signal.
bool timedWait (unsigned int ms)
 Wait for the conditional to get a signal, but only wait a certain time.
void signal ()
 Wakes up at least one thread blocked on this condition lock.
void broadcast ()
 This wakes up all of the threads blocked on the condition lock.

Protected Attributes

pthread_cond_t cond

Detailed Description

The ConditionLock is a little more advanced version of MutexLock in that it can wait for an arbitrary action in the other thread.

Thread 1 l.lock() l.wait() - lock will be released and the thread will wait for a signal from another thread before continuing. When it continues the lock is aquired again. l.unlock()

Thread 2 l.lock() do some stuff l.signal() - wake the waiting thread l.unlock()


Member Function Documentation

bool ConditionLock::timedWait unsigned int  ms  ) 
 

Wait for the conditional to get a signal, but only wait a certain time.

If the time exceeds the specified time false is returned. If signal is received true is returned.

void ConditionLock::wait  ) 
 

Wait for the conditional to get a signal.

The lock will be released while waiting and reaquired when a signal is received.


Generated on Thu Aug 24 12:40:09 2006 for H3D API by  doxygen 1.4.5