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 8d87aa41b9
commit e7dab19260
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)