Google

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Event Class Reference

The Event class implements a feature originally found in the WIN32 API; event notification. Thread synchornization on event notification. More...

#include <thread.h>

Inheritance diagram for Event:

Mutex List of all members.

Public Methods

 Event ()
 ~Event ()
void Reset (void)
 Once signaled, the Event class must be "reset" before responding to a new signal. More...

void Signal (void)
 Signal the event for the waiting thread.

bool Wait (timeout_t timer = 0)
 Wait either for the event to be signaled by another thread or for the specified timeout duration. More...


Protected Attributes

pthread_cond_t _cond
bool _signaled
int _count

Detailed Description

The Event class implements a feature originally found in the WIN32 API; event notification. Thread synchornization on event notification.

A target thread waits on a resetable Event, and one or more other threads can then signal the waiting thread to resume execution. A timeout can be used to specify a wait duration in milliseconds. The Event class must be reset before it can be used again as a trigger. These event objects use a trigger/reset mechanism and are related to low level conditional variables.

@author: David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

Event::Event ( )
 

Event::~Event ( ) [inline]
 


Member Function Documentation

void Event::Reset ( void ) [inline]
 

Once signaled, the Event class must be "reset" before responding to a new signal.

See also:
Signal

void Event::Signal ( void )
 

Signal the event for the waiting thread.

bool Event::Wait ( timeout_t timer = 0 )
 

Wait either for the event to be signaled by another thread or for the specified timeout duration.

See also:
Signal
Returns:
true if signaled, false if timed out.
Parameters:
timer   timeout in milliseconds to wait for a signal.


Member Data Documentation

pthread_cond_t Event::_cond [protected]
 

int Event::_count [protected]
 

bool Event::_signaled [protected]
 


The documentation for this class was generated from the following file:
Generated at Fri Mar 23 10:47:55 2001 for CommonC++ by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000