Timer Queuing Conflicts, handling timer queuing conflicts, timer busy mode
Control what happens when timer callbacks are still queued when a fixed-rate timer fires again.
📄Description

Timer callback execution is serialized by the evaluator. A fixed-rate timer can fire again while a previous TimerFcn callback is still queued or running. The BusyMode property controls how Nelson resolves this conflict.

BusyMode Behavior
drop Keep at most one pending callback for the timer. Extra firings are discarded.
queue Queue each firing. The timer can continue executing callbacks after the scheduled firing times have passed.
error Stop the timer and execute ErrorFcn, then StopFcn if those callbacks are defined.

BusyMode applies to fixedRate execution. For fixedDelay and fixedSpacing, the next firing is scheduled after the callback completes, so callbacks do not pile up in the same way.

💡Examples
Use queue mode when every scheduled firing should be kept.
t = timer('ExecutionMode', 'fixedRate', ...
  'BusyMode', 'queue', ...
  'Period', 0.02, ...
  'TasksToExecute', 3, ...
  'TimerFcn', @(src, event) sleep(0.03));
start(t);
wait(t);
get(t, 'TasksExecuted')
delete(t);
Use error mode to stop when the callback queue cannot keep up.
t = timer('ExecutionMode', 'fixedRate', ...
  'BusyMode', 'error', ...
  'Period', 0.02, ...
  'TasksToExecute', 5, ...
  'TimerFcn', @(src, event) sleep(0.03), ...
  'ErrorFcn', @(src, event) disp('timer queue conflict'));
start(t);
wait(t);
get(t, 'Running')
delete(t);
🔗See Also
timerTimer Callback Functionsset
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub