diff options
-rw-r--r-- | firmware/kernel.c | 14 |
1 files changed, 14 insertions, 0 deletions
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, | |||
224 | /**************************************************************************** | 224 | /**************************************************************************** |
225 | * Thread stuff | 225 | * Thread stuff |
226 | ****************************************************************************/ | 226 | ****************************************************************************/ |
227 | |||
228 | /* Suspends a thread's execution for at least the specified number of ticks. | ||
229 | * May result in CPU core entering wait-for-interrupt mode if no other thread | ||
230 | * may be scheduled. | ||
231 | * | ||
232 | * NOTE: sleep(0) sleeps until the end of the current tick | ||
233 | * sleep(n) that doesn't result in rescheduling: | ||
234 | * n <= ticks suspended < n + 1 | ||
235 | * n to n+1 is a lower bound. Other factors may affect the actual time | ||
236 | * a thread is suspended before it runs again. | ||
237 | */ | ||
227 | unsigned sleep(unsigned ticks) | 238 | unsigned sleep(unsigned ticks) |
228 | { | 239 | { |
229 | /* In certain situations, certain bootloaders in particular, a normal | 240 | /* In certain situations, certain bootloaders in particular, a normal |
@@ -237,6 +248,9 @@ unsigned sleep(unsigned ticks) | |||
237 | return 0; | 248 | return 0; |
238 | } | 249 | } |
239 | 250 | ||
251 | /* Elects another thread to run or, if no other thread may be made ready to | ||
252 | * run, immediately returns control back to the calling thread. | ||
253 | */ | ||
240 | void yield(void) | 254 | void yield(void) |
241 | { | 255 | { |
242 | /* In certain situations, certain bootloaders in particular, a normal | 256 | /* In certain situations, certain bootloaders in particular, a normal |