MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sleep

Function sleep

components/libc/posix/delay/delay.c:77–93  ·  view source on GitHub ↗

* @brief Delays the execution of the current thread for the specified number of seconds. * * @param seconds The number of seconds to sleep. * * @return Returns 0 on success. */

Source from the content-addressed store, hash-verified

75 * @return Returns 0 on success.
76 */
77unsigned int sleep(unsigned int seconds)
78{
79 if (rt_thread_self() != RT_NULL)
80 {
81 ssleep(seconds);
82 }
83 else /* scheduler has not run yet */
84 {
85 while(seconds > 0)
86 {
87 udelay(1000000u);
88 seconds --;
89 }
90 }
91
92 return 0;
93}
94RTM_EXPORT(sleep);
95
96/**

Callers 2

check_passwdFunction · 0.50
check_passwdFunction · 0.50

Calls 3

rt_thread_selfFunction · 0.85
ssleepFunction · 0.85
udelayFunction · 0.70

Tested by

no test coverage detected