Open Lighting Architecture: ola::io::TimeoutManager Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
ola::io::TimeoutManager Class Reference

## Detailed Description

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.
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"

## Constructor & Destructor Documentation

## ◆ TimeoutManager()

ola::io::TimeoutManager::TimeoutManager | ( | ola::ExportMap * | export_map,
|  | Clock * | clock )

Create a new TimeoutManager.

Parameters

  export_map | an ExportMap to update
  clock | the Clock to use.

## Member Function Documentation

## ◆ CancelTimeout()

void ola::io::TimeoutManager::CancelTimeout | ( | ola::thread::timeout_id | id | ) |

Cancel a timeout.

Parameters

  id | the id of the timeout

## ◆ EventsPending()

bool ola::io::TimeoutManager::EventsPending | ( |  | ) | const
| inline

Check if there are any events in the queue. Events remain in the queue even if they have been cancelled.

Returns
  true if there are events pending, false otherwise.

## ◆ ExecuteTimeouts()

TimeInterval ola::io::TimeoutManager::ExecuteTimeouts | ( | TimeStamp * | now | ) |

Execute any expired timeouts.

Parameters

  [in,out] | now | the current time, set to the last time events were checked.

Returns
  the time until the next event.

## ◆ RegisterRepeatingTimeout()

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.

Parameters

  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.

Returns
  the identifier for this timeout, this can be used to remove it later.

## ◆ RegisterSingleTimeout()

timeout_id ola::io::TimeoutManager::RegisterSingleTimeout | ( | const ola::TimeInterval & | interval,
|  | ola::SingleUseCallback0< void > * | closure )

Register a single use timeout function.

Parameters

  interval | the delay between function calls
  closure | the Callback to invoke when the event triggers

Returns
  the identifier for this timeout, this can be used to remove it later.

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

- common/io/TimeoutManager.h
- common/io/TimeoutManager.cpp