ucc::TimedEvent Class Reference

Event notification to manage scheduled realtime threads. More...

#include <thread.h>

Inheritance diagram for ucc::TimedEvent:

Inheritance graph
[legend]
Collaboration diagram for ucc::TimedEvent:

Collaboration graph
[legend]

Public Member Functions

 TimedEvent (void)
 Create event handler and timer for timing of events.
 TimedEvent (timeout_t timeout)
 Create event handler and timer set to trigger a timeout.
 TimedEvent (time_t timeout)
 Create event handler and timer set to trigger a timeout.
 ~TimedEvent ()
 Destroy timer and release pending events.
void signal (void)
 Signal pending event.
bool wait (timeout_t timeout)
 Wait to be signalled or until timer expires.
void reset (void)
 Reset triggered conditional.

Static Public Member Functions

static void signal (TimedEvent &timed)
 Event function for external type.
static void reset (TimedEvent &timed)
 Event function to reset timer for external type.
static bool wait (TimedEvent &timed, timeout_t timeout)
 Event function for external type for waiting.

Protected Member Functions

void lock (void)
 Lock the object for wait or to manipulate derived data.
void release (void)
 Release the object lock after waiting.
bool sync (void)
 Wait while locked.

Detailed Description

Event notification to manage scheduled realtime threads.

The timer is advanced to sleep threads which then wakeup either when the timer has expired or they are notified through the signal handler. This can be used to schedule and signal one-time completion handlers or for time synchronized events signaled by an asychrononous I/O or event source.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 345 of file thread.h.


Constructor & Destructor Documentation

ucc::TimedEvent::TimedEvent ( timeout_t  timeout  ) 

Create event handler and timer set to trigger a timeout.

Parameters:
timeout in milliseconds.

ucc::TimedEvent::TimedEvent ( time_t  timeout  ) 

Create event handler and timer set to trigger a timeout.

Parameters:
timeout in seconds.


Member Function Documentation

void ucc::TimedEvent::lock ( void   )  [protected]

Lock the object for wait or to manipulate derived data.

This is relevant to manipulations in a derived class.

void ucc::TimedEvent::release ( void   )  [protected]

Release the object lock after waiting.

This is relevent to manipulations in a derived class.

static void ucc::TimedEvent::reset ( TimedEvent timed  )  [inline, static]

Event function to reset timer for external type.

Parameters:
timed event object to reset.

Definition at line 432 of file thread.h.

Here is the call graph for this function:

static void ucc::TimedEvent::signal ( TimedEvent timed  )  [inline, static]

Event function for external type.

Parameters:
timed event object to signal.

Definition at line 425 of file thread.h.

Here is the call graph for this function:

void ucc::TimedEvent::signal ( void   ) 

Signal pending event.

Object may be locked or unlocked. The signalling thread may choose to lock and check a condition in a derived class before signalling.

bool ucc::TimedEvent::sync ( void   )  [protected]

Wait while locked.

This can be used in more complex derived objects where we are concerned with synchronized access between the signaling and event thread. This can be used in place of wait, but lock and release methods must be used around it.

Returns:
true if time expired.

static bool ucc::TimedEvent::wait ( TimedEvent timed,
timeout_t  timeout 
) [inline, static]

Event function for external type for waiting.

Parameters:
timed event object to wait on.
timeout to wait from last reset.
Returns:
true if signalled, false if timeout.

Definition at line 441 of file thread.h.

Here is the call graph for this function:

bool ucc::TimedEvent::wait ( timeout_t  timeout  ) 

Wait to be signalled or until timer expires.

This is a wrapper for expire for simple completion events.

Parameters:
timeout to wait from last reset.
Returns:
true if signaled, false if timeout.


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

Generated on Mon Jul 27 21:11:23 2009 for UCommon by  doxygen 1.5.9