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:
Anas Nashif 2020-10-17 07:52:17 -04:00
commit d2c71796af
2 changed files with 3 additions and 0 deletions

View file

@ -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

View file

@ -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;