From my current code:Code:class thread { public: thread(void (__cdecl *func)(void*) = thread::run, void *param = 0); static void sleep(uint32 milliseconds); private: static void run(void *param); uint32 m_thread; };Code:thread::thread(void (__cdecl *func)(void*), void *param) { m_thread = _beginthread(func, 0, param); if(!m_thread) { throw std::runtime_error("Could not create thread"); } } void thread::run(void *param) { _endthread(); // exit } void thread::sleep(uint32 milliseconds) { return Sleep(milliseconds); }




Reply With Quote