TimerProcess: prevent a race in setting up the timer callbacks

This commit is contained in:
Andrew Tridgell 2011-12-28 15:56:15 +11:00
parent b108b907e0
commit f8e1d88815
1 changed files with 2 additions and 0 deletions

View File

@ -49,8 +49,10 @@ void AP_TimerProcess::register_process(ap_procedure proc)
for (uint8_t i=0; i<_pidx; i++) {
if (_proc[i] == proc) return;
}
cli();
if (_pidx < AP_TIMERPROCESS_MAX_PROCS)
_proc[_pidx++] = proc;
sei();
}
void AP_TimerProcess::set_failsafe(ap_procedure proc)