From c7667023d22d576485c37c9693f8f6d8d72ddd07 Mon Sep 17 00:00:00 2001 From: Kevin Chase Date: Sun, 6 Jun 2004 02:44:44 -0700 Subject: [patch] Windows/Win32 thread handle leak with threads join From: "Kevin Chase" Message-ID: p4raw-id: //depot/perl@22918 --- ext/threads/threads.xs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ext/threads') diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index 9d4b2bb261..e52143d587 100755 --- a/ext/threads/threads.xs +++ b/ext/threads/threads.xs @@ -150,6 +150,11 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why) } MUTEX_UNLOCK(&thread->mutex); MUTEX_DESTROY(&thread->mutex); +#ifdef WIN32 + if (thread->handle) + CloseHandle(thread->handle); + thread->handle = 0; +#endif PerlMemShared_free(thread); if (freeperl) perl_free(freeperl); @@ -566,6 +571,8 @@ Perl_ithread_join(pTHX_ SV *obj) MUTEX_UNLOCK(&thread->mutex); #ifdef WIN32 waitcode = WaitForSingleObject(thread->handle, INFINITE); + CloseHandle(thread->handle); + thread->handle = 0; #else pthread_join(thread->thr,&retval); #endif -- cgit v1.2.1