From: Kevin Chase Date: Sun, 6 Jun 2004 09:44:44 +0000 (-0700) Subject: [patch] Windows/Win32 thread handle leak with threads join X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c7667023d22d576485c37c9693f8f6d8d72ddd07;p=p5sagit%2Fp5-mst-13.2.git [patch] Windows/Win32 thread handle leak with threads join From: "Kevin Chase" Message-ID: p4raw-id: //depot/perl@22918 --- diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index 9d4b2bb..e52143d 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