12 #include "../stdafx.h" 
   15 #include "../core/alloc_func.hpp" 
   19 #include "../os/windows/win32.h" 
   21 #include "../safeguards.h" 
   44     self_destruct(self_destruct),
 
   47     this->
thread = (HANDLE)_beginthreadex(NULL, 0, &
stThreadProc, 
this, CREATE_SUSPENDED, &this->
id);
 
   48     if (this->
thread == NULL) 
return;
 
   49     ResumeThread(this->
thread);
 
   54     if (this->
thread != NULL) {
 
   62     assert(GetCurrentThreadId() == this->
id);
 
   70     assert(GetCurrentThreadId() != this->
id);
 
   71     WaitForSingleObject(this->
thread, INFINITE);
 
   93     SetWin32ThreadName(-1, this->
name);
 
  109   if (thread != NULL) *thread = to;
 
  126     this->
event = CreateEvent(NULL, FALSE, FALSE, NULL);
 
  132     CloseHandle(this->
event);
 
  154     WaitForSingleObject(this->
event, INFINITE);
 
  160     SetEvent(this->
event);