Open Lighting Architecture
0.9.0
|
Manages timer events.
The TimeoutManager allows Callbacks to trigger at some point in the future. Callbacks can be invoked once, or periodically.
Classes | |
class | Event |
struct | ltevent |
class | RepeatingEvent |
class | SingleEvent |
Public Member Functions | |
TimeoutManager (ola::ExportMap *export_map, Clock *clock) | |
Create a new TimeoutManager. | |
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. | |
ola::thread::timeout_id | RegisterSingleTimeout (const ola::TimeInterval &interval, ola::SingleUseCallback0< void > *closure) |
Register a single use timeout function. | |
void | CancelTimeout (ola::thread::timeout_id id) |
Cancel a timeout. | |
bool | EventsPending () const |
Check if there are any events in the queue. Events remain in the queue even if they have been cancelled. | |
TimeInterval | ExecuteTimeouts (TimeStamp *now) |
Execute any expired timeouts. |
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 |