summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chase <kevincha99@hotmail.com>2004-06-06 02:44:44 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-09 12:43:59 +0000
commitc7667023d22d576485c37c9693f8f6d8d72ddd07 (patch)
treeefa36b82c55b602f677950b5b1528de762e4e8fb
parentb20ef1a8a713687d59ce9cae39255f394d96e412 (diff)
downloadperl-c7667023d22d576485c37c9693f8f6d8d72ddd07.tar.gz
[patch] Windows/Win32 thread handle leak with threads join
From: "Kevin Chase" <kevincha99@hotmail.com> Message-ID: <BAY2-F172Ih5h5xf4rJ0001a3a6@hotmail.com> p4raw-id: //depot/perl@22918
-rwxr-xr-xext/threads/threads.xs7
1 files changed, 7 insertions, 0 deletions
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