About
A timer can be used to execute a certain function periodically.
TimerInterface
A new timer instance is created with these static functions:
The created timer instance is controlled with these functions:
These observables are called on certain events:
- ObservableTimerStarted: Notifies the observers that the timer has started.
- ObservableTimerFinished: Notifies the observers that the timer has finished.
- ObservableTimerOverload: Notifies the observers that the timer job took longer than the specified interval.
auto TimerFunction = []()
{
if (g_count < 10)
{
++g_count;
}
else
{
g_timer.Cancel();
}
};
Further Reading