12 #include "../stdafx.h"
15 #include "../core/alloc_func.hpp"
20 #include "../safeguards.h"
42 self_destruct(self_destruct)
44 this->
thread = (HANDLE)_beginthreadex(NULL, 0, &
stThreadProc,
this, CREATE_SUSPENDED, &this->
id);
45 if (this->
thread == NULL)
return;
46 ResumeThread(this->
thread);
51 if (this->
thread != NULL) {
59 assert(GetCurrentThreadId() == this->
id);
67 assert(GetCurrentThreadId() != this->
id);
68 WaitForSingleObject(this->
thread, INFINITE);
102 if (thread != NULL) *thread = to;
119 this->
event = CreateEvent(NULL, FALSE, FALSE, NULL);
125 CloseHandle(this->
event);
147 WaitForSingleObject(this->
event, INFINITE);
153 SetEvent(this->
event);