Class representing timers and tasks that can be registered and executed by the dispatcher thread.
More...
#include <fw/DispatcherThread.h>
Class representing timers and tasks that can be registered and executed by the dispatcher thread.
Timers have an invocation time when they will be executed again. Timers will be rescheduled after invocation based on their period. Tasks form a kind of single shot timer that will be executed once at a given time.
- Examples:
- tutorials/FloatProducer.C.
◆ Timer() [1/2]
Constructs a timer with a given callback that is called whenever the timers invocation time is due and a period in which the timer is rescheduled after invocation.
◆ Timer() [2/2]
Constructs a one shot timer or task with a given callback that is called once at the timers/tasks invocation time and a specified time.
◆ updateInvocationTime()
void updateInvocationTime |
( |
| ) |
|
|
inlineprotected |
Called by dispatcher when timer is rescheduled.
◆ run()
Called from dispatcher thread this runnable is attached to, whenever the runnable should be executed.
Implements IRunnable.
◆ isActive()
Returns if the timer is active.
◆ setPeriod()
Changes the period of the timer.
New period will be used next time the timer gets rescheduled.
◆ getPeriod()
Returns the current period of the timer.
◆ setTolerance()
Set the tolerance that is allowed to exceed the next invocation time before issuing a warning and resetting the invocation time.
If invalid then there is no limit for exceeding the time.
◆ getTolerance()
Get the tolerance for exceed the next invocation time.
Invalid if not specified.
◆ getExceedance()
Checks and returns the amount of time the timer has exceeded the expected invocation time.
Returns 0 for timers that have 0 as period or if the exceeded time is inside the specified tolerance.
◆ start()
Start the timer (activates it)
◆ stop()
Stops a timer (deactivates it)
◆ getNextInvocationTime()
Time getNextInvocationTime |
( |
| ) |
const |
|
inline |
Return next time of execution.
◆ DispatcherThread
Only dispatcher thread can create us.
◆ last
time the last callback happened
◆ currentExpected
time the current callback should be happening
◆ current
time the current callback was actually called (Time::now() as of the beginning of the callback)
◆ lastDuration
How long the last callback ran for.
The documentation for this class was generated from the following file: