From 349a63aeed6cdeb89bf18c7b2e2c40782c79cc00 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 29 Jun 2016 12:52:37 -0700 Subject: [PATCH] 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 --- src/kernel/ao_task.c | 2 ++ 1 file changed, 2 insertions(+) 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); } -- 2.30.2