A library for managing timers.
More...
Classes | |
class | timer::Timer |
base class from which you can inherit and construct your own timers More... | |
class | timer::Queue |
this is a queue to which Timer objects can be added More... | |
Functions | |
virtual void | timer::Timer::notifyTimer (void)=0 |
this method is called when the timer goes off | |
virtual void | timer::Queue::addTimer (IN qword_t usFromNow, IN smart_ptr< Timer > &timer)=0 |
add a timer which will go off in usFromNow microseconds | |
virtual void | timer::Queue::setTime (IN qword_t usSinceEpoch)=0 throw () |
update the current time of the Queue object | |
virtual void | timer::Queue::checkTimers (IN qword_t usSinceEpoch)=0 |
check all timers, given the current time. | |
| |
static smart_ptr< Queue > | timer::Queue::create (void) |
virtual | timer::Timer::~Timer (void) throw () |
A library for managing timers.
General usage:
Time is specified using qword_t types (64 bit unsigned integers). This is the number of microseconds since the Epoch (Jan 1 1970). Theoretically this gives you microsecond-level timing for the next 584 thousand years. In practice, I doubt the kernel scheduler will do much better than millisecond resolution.
The Queue object is threadsafe. Thread safety of individual Timer objects is up to the implementer.
virtual void timer::Timer::notifyTimer | ( | void | ) | [pure virtual, inherited] |
this method is called when the timer goes off
virtual void timer::Queue::addTimer | ( | IN qword_t | usFromNow, | |
IN smart_ptr< Timer > & | timer | |||
) | [pure virtual, inherited] |
add a timer which will go off in usFromNow microseconds
virtual void timer::Queue::setTime | ( | IN qword_t | usSinceEpoch | ) | throw () [pure virtual, inherited] |
update the current time of the Queue object
virtual void timer::Queue::checkTimers | ( | IN qword_t | usSinceEpoch | ) | [pure virtual, inherited] |
check all timers, given the current time.
Internally, this also calls setTime(). So if you call checkTimers() often you may never need to call setTime() explicitly.
smart_ptr< Queue > timer::Queue::create | ( | void | ) | [static, inherited] |