From: Keith Packard Date: Sun, 17 Jun 2012 23:12:18 +0000 (-0700) Subject: altos: Don't lose IRQ disabled state in ao_sleep X-Git-Tag: 1.0.9.6~63 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=9d3fe2a80d0925e3eded6d738d05c5b4ea61504c altos: Don't lose IRQ disabled state in ao_sleep Using ao_arch_critical around the wchan setting will force interrupts to be re-enabled before ao_yield records the state of that bit, potentially causing problems with functions not atomically testing and sleeping. Tasks that need to set wchan with interrupts disabled should have interrupts disabled when entering ao_sleep already. Signed-off-by: Keith Packard --- diff --git a/src/core/ao_task.c b/src/core/ao_task.c index d7d0e8a2..910f1587 100644 --- a/src/core/ao_task.c +++ b/src/core/ao_task.c @@ -103,9 +103,7 @@ ao_yield(void) ao_arch_naked_define uint8_t ao_sleep(__xdata void *wchan) { - ao_arch_critical( - ao_cur_task->wchan = wchan; - ); + ao_cur_task->wchan = wchan; ao_yield(); if (ao_cur_task->wchan) { ao_cur_task->wchan = NULL;