From: Keith Packard Date: Wed, 29 Jun 2016 19:52:37 +0000 (-0700) Subject: altos: Make ao_delay(0) not wait forever X-Git-Tag: 1.6.5~1^2~10 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=349a63aeed6cdeb89bf18c7b2e2c40782c79cc00 altos: Make ao_delay(0) not wait forever ao_delay() is implemented on top of ao_sleep_for, and ao_sleep_for uses the timeout value of 0 to indicate an infinite timeout. Calls to ao_delay for 0 ticks would unintentionally hit this case and end up waiting forever.x Signed-off-by: Keith Packard --- diff --git a/src/kernel/ao_task.c b/src/kernel/ao_task.c index 47352fc1..0a790ccd 100644 --- a/src/kernel/ao_task.c +++ b/src/kernel/ao_task.c @@ -504,6 +504,8 @@ static __xdata uint8_t ao_forever; void ao_delay(uint16_t ticks) { + if (!ticks) + ticks = 1; ao_sleep_for(&ao_forever, ticks); }