win32: close thread handle when finished
This commit is contained in:
parent
1b04ef4cb1
commit
37a533740b
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue