diff options
author | Keith Packard <keithp@keithp.com> | 2016-06-28 17:04:59 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-06-29 19:17:45 -0700 |
commit | a7e0bb5eb661cfde31c383d605cb9cb8ca568bc7 (patch) | |
tree | cd6906fcb623ce67f4bef9799b98d8d7096db7b2 /src/kernel/ao_task.c | |
parent | 40abb0d1e2f43a60ffa34b055ebb913ee3e20faf (diff) |
altos: Block interrupts while waking tasks sleeping on timers.
Interrupts may not be blocked in the timer ISR, but they need to be
while walking the pending timer list and moving tasks back to the run
queue.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_task.c')
-rw-r--r-- | src/kernel/ao_task.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/kernel/ao_task.c b/src/kernel/ao_task.c index e430edc6..03d69caa 100644 --- a/src/kernel/ao_task.c +++ b/src/kernel/ao_task.c @@ -165,13 +165,14 @@ ao_task_check_alarm(uint16_t tick) { struct ao_task *alarm, *next; - ao_list_for_each_entry_safe(alarm, next, &alarm_queue, struct ao_task, alarm_queue) { - if ((int16_t) (tick - alarm->alarm) < 0) - break; - alarm->alarm = 0; - ao_task_from_alarm_queue(alarm); - ao_task_to_run_queue(alarm); - } + ao_arch_critical( + ao_list_for_each_entry_safe(alarm, next, &alarm_queue, struct ao_task, alarm_queue) { + if ((int16_t) (tick - alarm->alarm) < 0) + break; + alarm->alarm = 0; + ao_task_from_alarm_queue(alarm); + ao_task_to_run_queue(alarm); + }); } void |