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.
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);
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);
| Version | Description |
|---|---|
| 2.0.0 | initial version |