diff options
author | mdejong <mdejong@noemail.net> | 2001-07-24 19:47:02 (GMT) |
---|---|---|
committer | mdejong <mdejong@noemail.net> | 2001-07-24 19:47:02 (GMT) |
commit | da1c0e8f3adf4497ec80603daba3679e7e2196a1 (patch) | |
tree | 58dd09892bc3a588381c65d1da26236b6235024a /win/tclWinThrd.c | |
parent | 930ca4a77932fb36399f8f319d04235f9ec41288 (diff) | |
download | tcl-da1c0e8f3adf4497ec80603daba3679e7e2196a1.zip tcl-da1c0e8f3adf4497ec80603daba3679e7e2196a1.tar.gz tcl-da1c0e8f3adf4497ec80603daba3679e7e2196a1.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.
FossilOrigin-Name: e81a6a1d2ca99e554a5478306f206b6b5512043c
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r-- | win/tclWinThrd.c | 11 |
1 files changed, 6 insertions, 5 deletions
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; } |