@ -84,9 +84,13 @@ void Thread::detach()
/* Helper to sleep the current thread. */
void Thread::sleep(uint32_t ms)
void Thread::sleep(uint32_t ms, uint32_t us)
{
::usleep(ms * 1000);
if (us > 0U) {
::usleep(us);
} else {
::usleep(ms * 1000U);
}
// ---------------------------------------------------------------------------
@ -77,8 +77,9 @@ public:
/**
* @brief Helper to sleep the current thread.
* @param ms Time in milliseconds to sleep.
* @param us Time in microseconds to sleep.
*/
static void sleep(uint32_t ms);
static void sleep(uint32_t ms, uint32_t us = 0U);
private:
pthread_t m_thread;
Powered by TurnKey Linux.