summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2001-07-24 19:47:02 (GMT)
committermdejong <mdejong>2001-07-24 19:47:02 (GMT)
commit2414705dd748a119ffa0a2976ed71abc283aff11 (patch)
tree58dd09892bc3a588381c65d1da26236b6235024a
parent68b1df57ffd86cff434cc88071cd25fab54b9b11 (diff)
downloadtcl-2414705dd748a119ffa0a2976ed71abc283aff11.zip
tcl-2414705dd748a119ffa0a2976ed71abc283aff11.tar.gz
tcl-2414705dd748a119ffa0a2976ed71abc283aff11.tar.bz2
* win/tclWinThrd.c (Tcl_CreateThread): Close Windows
HANDLE returned by _beginthreadex. The MS documentation states that this handle is not closed by a later call to _endthreadex.
-rw-r--r--ChangeLog7
-rw-r--r--win/tclWinThrd.c11
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b7f8cb5..9e177ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-07-24 Mo DeJong <mdejong@redhat.com>
+
+ * win/tclWinThrd.c (Tcl_CreateThread): Close Windows
+ HANDLE returned by _beginthreadex. The MS documentation
+ states that this handle is not closed by a later call to
+ _endthreadex.
+
2001-07-21 Don Porter <dgp@users.sourceforge.net>
* doc/pkgMkindex.n:
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 466c715..78f32b5 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinThrd.c,v 1.12 2001/07/16 23:30:16 mdejong Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.13 2001/07/24 19:47:02 mdejong Exp $
*/
#include "tclWinInt.h"
@@ -131,14 +131,14 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags)
int flags; /* Flags controlling behaviour of
* the new thread */
{
- unsigned long code;
+ HANDLE tHandle;
EnterCriticalSection(&joinLock);
- code = _beginthreadex(NULL, (unsigned) stackSize, proc, clientData, 0,
- (unsigned *)idPtr);
+ tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, proc,
+ clientData, 0, (unsigned *)idPtr);
- if (code == 0) {
+ if (tHandle == 0) {
LeaveCriticalSection(&joinLock);
return TCL_ERROR;
} else {
@@ -146,6 +146,7 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags)
TclRememberJoinableThread (*idPtr);
}
+ CloseHandle(tHandle);
LeaveCriticalSection(&joinLock);
return TCL_OK;
}