Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes
Event Class Reference

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

#include <thread.h>

Collaboration diagram for Event:
Collaboration graph
[legend]

Public Member Functions

 Event ()
 
virtual ~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. More...
 
bool wait (timeout_t timer)
 Wait either for the event to be signaled by another thread or for the specified timeout duration. More...
 
bool wait (void)
 

Private Attributes

pthread_mutex_t _mutex
 
pthread_cond_t _cond
 
bool _signaled
 
int _count
 

Detailed Description

The Event class implements a feature originally found in the WIN32 API; 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.nosp@m.@ost.nosp@m.el.co.nosp@m.m Thread synchornization on event notification.

Definition at line 869 of file thread.h.

Constructor & Destructor Documentation

Event::Event ( )
virtual Event::~Event ( )
virtual

Member Function Documentation

void Event::reset ( void  )

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)

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
timertimeout in milliseconds to wait for a signal.
bool Event::wait ( void  )

Field Documentation

pthread_cond_t Event::_cond
private

Definition at line 874 of file thread.h.

int Event::_count
private

Definition at line 876 of file thread.h.

pthread_mutex_t Event::_mutex
private

Definition at line 873 of file thread.h.

bool Event::_signaled
private

Definition at line 875 of file thread.h.


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