From 5d35dba73da5917f0f7a56d37e448436a25e6c26 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Sun, 12 Feb 2017 10:22:05 -0500 Subject: [PATCH] kernel/timeouts: add description of timeouts queued on the same tick Change-Id: I24ba889e3174b903ccea5309ad45e2b4d1755fe1 Signed-off-by: Benjamin Walsh --- kernel/include/timeout_q.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/include/timeout_q.h b/kernel/include/timeout_q.h index 7b1dd47892f..291e32d700f 100644 --- a/kernel/include/timeout_q.h +++ b/kernel/include/timeout_q.h @@ -176,6 +176,21 @@ static inline void _dump_timeout_q(void) * * Cannot handle timeout == 0 and timeout == K_FOREVER. * + * If the new timeout is expiring on the same system clock tick as other + * timeouts already present in the _timeout_q, it is be _prepended_ to these + * timeouts. This allows exiting the loop sooner, which is good, since + * interrupts are locked while trying to find the insert point. Note that the + * timeouts are then processed in the _reverse order_ if they expire on the + * same tick. + * + * This should not cause problems to applications, unless they really expect + * two timeouts queued very close to one another to expire in the same order + * they were queued. This could be changed at the cost of potential longer + * interrupt latency. + * + * NOTE: The current implementation of the legacy semaphore feature depends on + * the timeouts being queued in reverse order. + * * Must be called with interrupts locked. */