kernel: document k_sleep with K_FOREVER
When calling k_sleep with K_FOREVER as the timeout value, we consider this as a suspend call. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
081605ee23
commit
d2c71796af
2 changed files with 3 additions and 0 deletions
|
@ -644,6 +644,8 @@ __syscall int k_thread_join(struct k_thread *thread, k_timeout_t timeout);
|
|||
* This routine puts the current thread to sleep for @a duration,
|
||||
* specified as a k_timeout_t object.
|
||||
*
|
||||
* @note if @a timeout is set to K_FOREVER then the thread is suspended.
|
||||
*
|
||||
* @param timeout Desired duration of sleep.
|
||||
*
|
||||
* @return Zero if the requested time has elapsed or the number of milliseconds
|
||||
|
|
|
@ -1310,6 +1310,7 @@ int32_t z_impl_k_sleep(k_timeout_t timeout)
|
|||
__ASSERT(!arch_is_in_isr(), "");
|
||||
sys_trace_void(SYS_TRACE_ID_SLEEP);
|
||||
|
||||
/* in case of K_FOREVER, we suspend */
|
||||
if (K_TIMEOUT_EQ(timeout, K_FOREVER)) {
|
||||
k_thread_suspend(_current);
|
||||
return (int32_t) K_TICKS_FOREVER;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue