Falcon::Event Class Reference

Generic event class. More...

#include <mt_posix.h>

List of all members.

Public Member Functions

 Event (bool bAutoReset=true, bool initState=false)
 Creates the mutex.
 Event (bool bAutoReset=true, bool initState=false)
 Creates the mutex.
void reset ()
 Resets the event.
void reset ()
 Resets the event.
void set ()
 Signals the event.
void set ()
 Signals the event.
bool wait (int32 to=-1)
 Waits on the given event.
bool wait (int32 to=-1)
 Waits on the given event.
 ~Event ()
 Destroys the event.
 ~Event ()
 Destroys the event.


Detailed Description

Generic event class.

Directly mapping to the underlying type via inline functions.

Well, events are definitely not the best way to handle MT things, the mutex / POSIX cv / predicate is definitely better (faster, more flexible, safer etc), but we're using a set of definite MT patterns in which using MS-WIN style events doesn't make a great difference.

For low level business (i.e. implementing the script-level Waitable system) we're still using the system specific features (multiple wait on MS-WIN, condvars on POSIX). This is class is used as a middle-level equalizer in simple MT tasks as i.e. signaling non-empty queues or generic work-to-be-done flags.


Constructor & Destructor Documentation

Falcon::Event::Event ( bool  bAutoReset = true,
bool  initState = false 
) [inline]

Creates the mutex.

Will assert on failure.

References fassert.

Falcon::Event::~Event (  )  [inline]

Destroys the event.

Will assert on failure.

References fassert.

Falcon::Event::Event ( bool  bAutoReset = true,
bool  initState = false 
) [inline]

Creates the mutex.

Will assert on failure.

Falcon::Event::~Event (  )  [inline]

Destroys the event.

Will assert on failure.


Member Function Documentation

void Falcon::Event::reset (  )  [inline]

Resets the event.

Useful only if the event is not auto-reset.

void Falcon::Event::reset (  )  [inline]

Resets the event.

Useful only if the event is not auto-reset.

References fassert.

void Falcon::Event::set (  )  [inline]

Signals the event.

Will assert on failure -- but only in debug

void Falcon::Event::set (  ) 

Signals the event.

Will assert on failure -- but only in debug

bool Falcon::Event::wait ( int32  to = -1  )  [inline]

Waits on the given event.

The wait is not interruptible. If a thread is blocked on this wait, the event must be signaled somewhere else to allow it to proceed and check for closure request.

Falcon script level have better semantics, but this object is meant for fairly basic and low-level system related activites.

If the event is auto-reset, only one waiting thread is woken up, and after the wakeup the event is automatically reset.

Parameters:
to The timeout; set to < 0 for infinite timeout, 0 to check without blocking and > 0 for a number of MSecs wait.
Returns:
True if the event was signaled, false otherwise.

bool Falcon::Event::wait ( int32  to = -1  ) 

Waits on the given event.

The wait is not interruptible. If a thread is blocked on this wait, the event must be signaled somewhere else to allow it to proceed and check for closure request.

Falcon script level have better semantics, but this object is meant for fairly basic and low-level system related activites.

If the event is auto-reset, only one waiting thread is woken up, and after the wakeup the event is automatically reset.

Parameters:
to The timeout; set to < 0 for infinite timeout, 0 to check without blocking and > 0 for a number of MSecs wait.
Returns:
True if the event was signaled, false otherwise.


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

Generated on Mon Oct 19 10:11:34 2009 for Falcon_Core by  doxygen 1.5.8