win32: close thread handle when finished

This commit is contained in:
Flyinghead 2019-04-09 10:37:49 +02:00
parent 1b04ef4cb1
commit 37a533740b
1 changed files with 3 additions and 0 deletions

View File

@ -749,6 +749,7 @@ cThread::cThread(ThreadEntryFP* function,void* prm)
void cThread::Start() void cThread::Start()
{ {
verify(hThread == NULL);
hThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Entry,param,0,NULL); hThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Entry,param,0,NULL);
ResumeThread(hThread); ResumeThread(hThread);
} }
@ -756,6 +757,8 @@ void cThread::Start()
void cThread::WaitToEnd() void cThread::WaitToEnd()
{ {
WaitForSingleObject(hThread,INFINITE); WaitForSingleObject(hThread,INFINITE);
CloseHandle(hThread);
hThread = NULL;
} }
//End thread class //End thread class