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

Function usleep

components/libc/posix/delay/delay.c:103–116  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

101 * @return Returns 0 on success.
102 */
103int usleep(useconds_t usec)
104{
105 if (rt_thread_self() != RT_NULL)
106 {
107 msleep(usec / 1000u);
108 udelay(usec % 1000u);
109 }
110 else /* scheduler has not run yet */
111 {
112 udelay(usec);
113 }
114
115 return 0;
116}
117RTM_EXPORT(usleep);

Callers 2

libc_ex7Function · 0.50
libc_ex6Function · 0.50

Calls 3

rt_thread_selfFunction · 0.85
msleepFunction · 0.70
udelayFunction · 0.70

Tested by

no test coverage detected