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();
}
};
Timer value in seconds.
Definition: timevalue.h:411
static MAXON_FUNCTION Result< TimerRef > AddPeriodicTimer(TimeValue interval, FN &&job, JobQueueInterface *queue)
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
static const JobQueueInterface::Current JOBQUEUE_CURRENT
Equivalent to calling GetDestinationQueue(), you just save a function call.
Definition: jobqueue.h:377
#define iferr_return
Definition: resultbase.h:1465
Further Reading