From 2414705dd748a119ffa0a2976ed71abc283aff11 Mon Sep 17 00:00:00 2001 From: mdejong Date: Tue, 24 Jul 2001 19:47:02 +0000 Subject: * 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. --- ChangeLog | 7 +++++++ win/tclWinThrd.c | 11 ++++++----- 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 + + * 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 * 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; } -- cgit v0.12