kernel: sched: Make k_sleep() similar to POSIX equivalent
This commit introduces k_sleep() return value, which provides information about actual sleep time. If the returned value is not-zero, the thread slept shorter than requested, which is only possible if the thread has been woken up by k_wakeup() call. Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
parent
7791f58a15
commit
7700eb2a15
2 changed files with 17 additions and 10 deletions
|
@ -787,9 +787,11 @@ void k_thread_system_pool_assign(struct k_thread *thread);
|
|||
*
|
||||
* @param duration Number of milliseconds to sleep.
|
||||
*
|
||||
* @return N/A
|
||||
* @return Zero if the requested time has elapsed or the number of milliseconds
|
||||
* left to sleep, if thread was woken up by \ref k_wakeup call.
|
||||
*
|
||||
*/
|
||||
__syscall void k_sleep(s32_t duration);
|
||||
__syscall s32_t k_sleep(s32_t duration);
|
||||
|
||||
/**
|
||||
* @brief Cause the current thread to busy wait.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue