HAL_PX4: implement atomic operations

This commit is contained in:
Andrew Tridgell 2013-01-02 21:45:17 +11:00
parent 5a70f3becf
commit 5053fb8acc
1 changed files with 12 additions and 0 deletions

View File

@ -164,6 +164,12 @@ void PX4Scheduler::resume_timer_procs() {
void PX4Scheduler::begin_atomic() {
_nested_atomic_ctr++;
if (_nested_atomic_ctr == 1) {
sigset_t set;
sigemptyset(&set);
sigaddset(&set, MAIN_TIMER_SIGNAL);
sigprocmask(SIG_BLOCK, &set, NULL);
}
}
void PX4Scheduler::end_atomic() {
@ -172,6 +178,12 @@ void PX4Scheduler::end_atomic() {
return;
}
_nested_atomic_ctr--;
if (_nested_atomic_ctr == 0) {
sigset_t set;
sigemptyset(&set);
sigaddset(&set, MAIN_TIMER_SIGNAL);
sigprocmask(SIG_UNBLOCK, &set, NULL);
}
}
void PX4Scheduler::reboot()