Main Page Namespace List Class Hierarchy Compound List Compound Members

# ZThread::Timer Class Reference

`#include <Timer.h>`

Inheritance diagram for ZThread::Timer::

List of all members.

## Public Methods
| Timer () throw (Synchronization_Exception)
virtual | ~Timer () throw ()
void | addEvent (const TimerEvent &) throw (Synchronization_Exception)
void | addEvent (unsigned long, bool periodic=false) throw (Synchronization_Exception)
void | delEvent (const TimerEvent &) throw (Synchronization_Exception)
virtual void | run () throw ()
## Protected Types
typedef std::set<TimerEvent> | EventList
| Typedef.
## Protected Attributes
EventList | _eventList
| Registered events.
Condition | _interrupt
| Used to perform the timing.
FastMutex | _lock
| Used to serialize access.

## Detailed Description

Author:
  Eric Crahen

Version:
  1.4.1

Date:
  04-28-2001

This class defines a simple Timer object base. Other objects can be derived from this to create more specialzed Timers. This encapsulates the timing routines and doesn't force a timer to have a thread associated with it. A Timer task could be created and submitted to an execute or manually managed thread.

Interest in a timer is manipulated using the inherited Observable methods

## Constructor & Destructor Documentation

Timer ( | ) throw (Synchronization_Exception)

| Create a new Timer object

~Timer ( | ) throw ()`[virtual]`

| Destroy this Timer object

## Member Function Documentation

void addEvent ( | unsigned long,
| bool periodic = false ) throw (Synchronization_Exception)

  | Set a timer. This event will occur after the given amount of time expires. An appropriate TimerEvent will be constructed and submitted to the Timer based on the parameters passed to this function Parameters:
  unsigned | long - milliseconds until event
  bool | - event repeats
  Exceptions:
  Synchronization_Exception |
  Parameters:
  long |
  periodic |

void addEvent ( | const TimerEvent & ) throw (Synchronization_Exception)

  | Set a timer event. This event will occur after the given amount of time expires. Parameters:
  const | TimerEvent& - event to submit to the Timer
  Exceptions:
  Synchronization_Exception |

void delEvent ( | const TimerEvent & ) throw (Synchronization_Exception)

  | Remove a TimerEvent. Parameters:
  const | TimerEvent& - event to remove from the Timer
  Exceptions:
  Synchronization_Exception |

void run ( | ) throw ()`[virtual]`

| This method enters a loop, waiting on the condition variable that is associated with this object. This loop will executed until the Timer has been canceled. Reimplemented from ZThread::Runnable. Reimplemented in ZThread::TimerThread.

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

- Timer.h