Main Page   Namespace List   Class Hierarchy   Compound List   Compound Members  

ZThread::Condition Class Reference

#include <Condition.h>

List of all members.

Public Methods

 Condition () throw (Synchronization_Exception)
 ~Condition () throw ()
void signal () throw (Synchronization_Exception)
void broadcast () throw (Synchronization_Exception)
void wait (Lockable &) throw (Synchronization_Exception)
bool wait (Lockable &, unsigned long) throw (Synchronization_Exception)


Detailed Description

Author:
Eric Crahen
Version:
1.3.4
Date:
04-12-2001

Condition variables can be used to block threads until a condition has been signaled. This is very much like a POSIX condition variable. Threads wait() ing on this object are blocked until they receive signal.

A Condition variable must be used in conjunction with a Lockable object The lockable object should be locked prior to calling one of the wait() functions. That object will be released while the caller is blocked. When the thread that has been blocked by the condition receives a signal that lockable object will be locked once again before the wait() returns.


Constructor & Destructor Documentation

Condition ( ) throw (Synchronization_Exception)
 

Create a new condition variable

Exceptions:
Initialization_Exception   thrown if resources to allocate the object could not be allocated

~Condition ( ) throw ()
 

Destroy Condition object


Member Function Documentation

void broadcast ( ) throw (Synchronization_Exception)
 

Wake ALL threads waiting on this condition variable.

Exceptions:
Synchronization_Exception   thrown on a general error with the underlying implementation object

void signal ( ) throw (Synchronization_Exception)
 

Wake ONE thread waiting on this condition variable.

Exceptions:
Synchronization_Exception   thrown on a general error with the underlying implementation object

bool wait ( Lockable &,
unsigned long ) throw (Synchronization_Exception)
 

Wait for this Condition object to be signaled for at most 'ms' milliseconds.

Returns:
bool indicating the success of this operation
Parameters:
Lockable   & reference to a locked Lockable object
unsigned   long milliseconds to wait on for a signal()
Exceptions:
Interrupted_Exception   - thrown if a thread blocking on this object is interrupted
Unexpected_Exception   - thrown if the calling thread was killed can can't block
Synchronization_Exception   thrown on a general error with the underlying implementation object
Parameters:
long  

void wait ( Lockable & ) throw (Synchronization_Exception)
 

Wait for this Condition object to be signaled.

Returns:
bool indication the success of this operation
Parameters:
Lockable   & reference to a locked Lockable object
Exceptions:
Interrupted_Exception   - thrown if a thread blocking on this object is interrupted
Synchronization_Exception   thrown on a general error with the underlying implementation object


The documentation for this class was generated from the following file:
Generated at Fri Aug 31 09:07:59 2001 for ZThread by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001