mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-14 12:48:31 -04:00
TimerProcess: prevent a race in setting up the timer callbacks
This commit is contained in:
parent
b108b907e0
commit
f8e1d88815
@ -49,8 +49,10 @@ void AP_TimerProcess::register_process(ap_procedure proc)
|
|||||||
for (uint8_t i=0; i<_pidx; i++) {
|
for (uint8_t i=0; i<_pidx; i++) {
|
||||||
if (_proc[i] == proc) return;
|
if (_proc[i] == proc) return;
|
||||||
}
|
}
|
||||||
|
cli();
|
||||||
if (_pidx < AP_TIMERPROCESS_MAX_PROCS)
|
if (_pidx < AP_TIMERPROCESS_MAX_PROCS)
|
||||||
_proc[_pidx++] = proc;
|
_proc[_pidx++] = proc;
|
||||||
|
sei();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AP_TimerProcess::set_failsafe(ap_procedure proc)
|
void AP_TimerProcess::set_failsafe(ap_procedure proc)
|
||||||
|
Loading…
Reference in New Issue
Block a user