diff options
-rw-r--r-- | win/tclWinThrd.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index dd82617..b806630 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.16 2001/09/03 01:28:42 davygrvy Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.17 2001/09/05 00:32:31 davygrvy Exp $ */ #include "tclWinInt.h" @@ -133,16 +133,16 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags) EnterCriticalSection(&joinLock); -#ifdef __CYGWIN__ +#if defined(__MSVCRT__) || defined(__BORLANDC__) + tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, proc, + clientData, 0, (unsigned *)idPtr); +#else tHandle = CreateThread(NULL, (DWORD) stackSize, (LPTHREAD_START_ROUTINE) proc, (LPVOID) clientData, (DWORD) 0, (LPDWORD)idPtr); -#else - tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, proc, - clientData, 0, (unsigned *)idPtr); #endif - if (tHandle == 0) { + if (tHandle == NULL) { LeaveCriticalSection(&joinLock); return TCL_ERROR; } else { @@ -154,6 +154,7 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags) * The only purpose of this is to decrement the reference count so the * OS resources will be reaquired when the thread closes. */ + CloseHandle(tHandle); LeaveCriticalSection(&joinLock); return TCL_OK; @@ -211,10 +212,10 @@ TclpThreadExit(status) TclSignalExitThread (Tcl_GetCurrentThread (), status); LeaveCriticalSection(&joinLock); -#ifdef __CYGWIN__ - ExitThread((DWORD) status); -#else +#if defined(__MSVCRT__) || defined(__BORLANDC__) _endthreadex((DWORD)status); +#else + ExitThread((DWORD) status); #endif } |