-#ifdef WIN32
- DWORD dummy; // Win9x needs the lpTthreadId parameter
- priv_->handle = CreateThread(0, 0, &Private::main_wrapper, this, 0, &dummy);
-#else
- pthread_create(&priv_->handle, 0, &Private::main_wrapper, this);
-#endif
- launched_ = true;
+ platform_launch();
+ _state = RUNNING;
+}
+
+ThreadReturn THREAD_CALL Thread::Private::main_wrapper(void *arg)
+{
+ Thread *thread = reinterpret_cast<Thread *>(arg);
+ thread->platform_setname();
+ thread->main();
+ thread->_state = FINISHED;
+ return nullptr;