feisty meow concerns codebase
2.140
|
Provides platform-independent timer support. More...
#include <timer_driver.h>
Public Member Functions | |
timer_driver () | |
virtual | ~timer_driver () |
DEFINE_CLASS_NAME ("timer_driver") | |
bool | set_timer (int duration, timeable *to_invoke) |
sets a timer to call "to_invoke" every "duration" milliseconds. More... | |
bool | zap_timer (timeable *to_drop) |
removes the timer that was established for "to_drop". More... | |
void | handle_system_timer () |
invoked by the OS timer support and must be called by main thread. More... | |
Static Public Member Functions | |
static timer_driver & | global_timer_driver () |
the first time this is invoked, it creates a program-wide timer driver. More... | |
Provides platform-independent timer support.
Multiple objects can be hooked to the timer to be called when their interval elapses. The driver allows new timeables to be added as needed.
NOTE: Only one of the timer_driver objects is allowed per program.
Definition at line 50 of file timer_driver.h.
timely::timer_driver::timer_driver | ( | ) |
Definition at line 147 of file timer_driver.cpp.
References timely::INITIAL_TIMER_GRANULARITY, NULL_POINTER, timely::OUR_SIGNAL, and timely::timer_driver_private_handler().
|
virtual |
uhhh
Definition at line 166 of file timer_driver.cpp.
References FUNCDEF, basis::mutex::lock(), LOG, NULL_POINTER, timely::OUR_SIGNAL, timely::PAUSE_TIME, timely::time_control::sleep_ms(), basis::mutex::unlock(), and basis::WHACK().
timely::timer_driver::DEFINE_CLASS_NAME | ( | "timer_driver" | ) |
|
static |
the first time this is invoked, it creates a program-wide timer driver.
void timely::timer_driver::handle_system_timer | ( | ) |
invoked by the OS timer support and must be called by main thread.
Definition at line 275 of file timer_driver.cpp.
References FUNCDEF, timely::INITIAL_TIMER_GRANULARITY, basis::array< contents >::length(), LOG, timely::MAX_TIMER_PREDICTION, timely::now(), and basis::astring::t().
bool timely::timer_driver::set_timer | ( | int | duration, |
timeable * | to_invoke | ||
) |
sets a timer to call "to_invoke" every "duration" milliseconds.
if the object "to_invoke" already exists, then its duration is changed.
Definition at line 249 of file timer_driver.cpp.
References FUNCDEF, LOG, and basis::negative().
bool timely::timer_driver::zap_timer | ( | timeable * | to_drop | ) |
removes the timer that was established for "to_drop".
do not zap a timer from its own callback! that could cause synchronization problems.
Definition at line 221 of file timer_driver.cpp.
References FUNCDEF, LOG, and basis::negative().