diff options
author | Keith Packard <keithp@keithp.com> | 2012-06-17 16:12:18 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-06-17 16:12:18 -0700 |
commit | 9d3fe2a80d0925e3eded6d738d05c5b4ea61504c (patch) | |
tree | 11ff8073f52a98fdd74ab9887f567c3a17a0d42a /src/core/ao_task.c | |
parent | 4e6d96816e6604ee8d9bb49345a1c1211699a655 (diff) |
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 <keithp@keithp.com>
Diffstat (limited to 'src/core/ao_task.c')
-rw-r--r-- | src/core/ao_task.c | 4 |
1 files changed, 1 insertions, 3 deletions
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; |