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>
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;