From 5334379cd470287da263bd19903022e36c255e55 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 15 Dec 2011 19:57:08 +0000 Subject: Add comments source comments about the behavior of yield and sleep. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31288 a1c6a512-1295-4272-9138-f99709370657 --- firmware/kernel.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/firmware/kernel.c b/firmware/kernel.c index b8556ce214..155205749f 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -224,6 +224,17 @@ void timeout_register(struct timeout *tmo, timeout_cb_type callback, /**************************************************************************** * Thread stuff ****************************************************************************/ + +/* Suspends a thread's execution for at least the specified number of ticks. + * May result in CPU core entering wait-for-interrupt mode if no other thread + * may be scheduled. + * + * NOTE: sleep(0) sleeps until the end of the current tick + * sleep(n) that doesn't result in rescheduling: + * n <= ticks suspended < n + 1 + * n to n+1 is a lower bound. Other factors may affect the actual time + * a thread is suspended before it runs again. + */ unsigned sleep(unsigned ticks) { /* In certain situations, certain bootloaders in particular, a normal @@ -237,6 +248,9 @@ unsigned sleep(unsigned ticks) return 0; } +/* Elects another thread to run or, if no other thread may be made ready to + * run, immediately returns control back to the calling thread. + */ void yield(void) { /* In certain situations, certain bootloaders in particular, a normal -- cgit v1.2.3