Open Lighting Architecture
Latest Git
|
Manages timer events.
The TimeoutManager allows Callbacks to trigger at some point in the future. Callbacks can be invoked once, or periodically.
Public Member Functions | |
TimeoutManager (ola::ExportMap *export_map, Clock *clock) | |
Create a new TimeoutManager. More... | |
ola::thread::timeout_id | RegisterRepeatingTimeout (const ola::TimeInterval &interval, ola::Callback0< bool > *closure) |
Register a repeating timeout. Returning false from the Callback will cancel this timer. More... | |
ola::thread::timeout_id | RegisterSingleTimeout (const ola::TimeInterval &interval, ola::SingleUseCallback0< void > *closure) |
Register a single use timeout function. More... | |
void | CancelTimeout (ola::thread::timeout_id id) |
Cancel a timeout. More... | |
bool | EventsPending () const |
Check if there are any events in the queue. Events remain in the queue even if they have been cancelled. More... | |
TimeInterval | ExecuteTimeouts (TimeStamp *now) |
Execute any expired timeouts. More... | |
Static Public Attributes | |
static const char | K_TIMER_VAR [] = "ss-timers" |
ola::io::TimeoutManager::TimeoutManager | ( | ola::ExportMap * | export_map, |
Clock * | clock | ||
) |
Create a new TimeoutManager.
void ola::io::TimeoutManager::CancelTimeout | ( | ola::thread::timeout_id | id | ) |
Cancel a timeout.
id | the id of the timeout |
|
inline |
Check if there are any events in the queue. Events remain in the queue even if they have been cancelled.
TimeInterval ola::io::TimeoutManager::ExecuteTimeouts | ( | TimeStamp * | now | ) |
Execute any expired timeouts.
[in,out] | now | the current time, set to the last time events were checked. |
timeout_id ola::io::TimeoutManager::RegisterRepeatingTimeout | ( | const ola::TimeInterval & | interval, |
ola::Callback0< bool > * | closure | ||
) |
Register a repeating timeout. Returning false from the Callback will cancel this timer.
interval | the delay before the closure will be run. |
closure | the closure to invoke when the event triggers. Ownership is given up to the select server - make sure nothing else uses this Callback. |
timeout_id ola::io::TimeoutManager::RegisterSingleTimeout | ( | const ola::TimeInterval & | interval, |
ola::SingleUseCallback0< void > * | closure | ||
) |
Register a single use timeout function.
interval | the delay between function calls |
closure | the Callback to invoke when the event triggers |