Merge pull request #1955 from nfedera/fix-2014-07-10-02

winpr: CloseHandle did not release the thread TCB
This commit is contained in:
Norbert Federa 2014-07-11 16:35:12 +02:00
commit 6b47229563
2 changed files with 5 additions and 0 deletions

View File

@ -139,6 +139,9 @@ BOOL CloseHandle(HANDLE hObject)
WINPR_THREAD* thread;
thread = (WINPR_THREAD*) Object;
if (thread->started) {
pthread_detach(thread->thread);
}
free(thread);
return TRUE;

View File

@ -259,6 +259,8 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
else
status = pthread_join(thread->thread, &thread_status);
thread->started = FALSE;
if (status != 0)
{
fprintf(stderr, "WaitForSingleObject: pthread_join failure: [%d] %s\n",