summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-06-29 12:52:37 -0700
committerKeith Packard <keithp@keithp.com>2016-06-29 19:17:45 -0700
commit349a63aeed6cdeb89bf18c7b2e2c40782c79cc00 (patch)
treebda1a149de2f0da47e5051eb98b539716a61cd07 /src/kernel
parent3b3a24f5f39a1b72cc8947c33b609f454b46aff8 (diff)
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 <keithp@keithp.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/ao_task.c2
1 files changed, 2 insertions, 0 deletions
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);
}