30 #ifndef _RL_UTIL_THREAD_H_
31 #define _RL_UTIL_THREAD_H_
63 CloseHandle((*this).thread);
70 return (*this).id == rhs.id;
72 return pthread_equal((*this).thread, rhs.
thread);
84 WaitForSingleObject((*this).thread, INFINITE);
86 pthread_join((*this).thread, NULL);
90 virtual void run() = 0;
92 static void sleep(
const double& seconds)
95 Sleep(static_cast< unsigned int >(seconds * 1000.0f));
97 usleep(static_cast< ::std::size_t >(seconds * 1000.0f * 1000.0f));
104 (*this).thread =
reinterpret_cast< void*
>(_beginthreadex(NULL, 0,
Thread::start,
this, 0, &(*this).id));
123 static unsigned int __stdcall
start(
void* arg)
145 #endif // _RL_UTIL_THREAD_H_