* @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. */
| 75 | * @return Returns 0 on success. |
| 76 | */ |
| 77 | unsigned 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 | } |
| 94 | RTM_EXPORT(sleep); |
| 95 | |
| 96 | /** |
no test coverage detected