27 #ifndef _RL_UTIL_THREAD_H_
28 #define _RL_UTIL_THREAD_H_
60 CloseHandle((*this).thread);
67 return (*this).id == rhs.id;
69 return pthread_equal((*this).thread, rhs.
thread);
81 WaitForSingleObject((*this).thread, INFINITE);
83 pthread_join((*this).thread, NULL);
87 virtual void run() = 0;
89 static void sleep(
const double& seconds)
92 Sleep(
static_cast< unsigned int >(seconds * 1000.0f));
94 usleep(
static_cast< ::std::size_t
>(seconds * 1000.0f * 1000.0f));
101 (*this).thread =
reinterpret_cast< void*
>(_beginthreadex(NULL, 0,
Thread::start,
this, 0, &(*this).id));
120 static unsigned int __stdcall
start(
void* arg)
142 #endif // _RL_UTIL_THREAD_H_