summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2001-09-05 00:32:31 (GMT)
committerdavygrvy <davygrvy@pobox.com>2001-09-05 00:32:31 (GMT)
commit7face33ee236bd41dc1aa0b476b04d4d1e512cbe (patch)
treef1f17972f3fd1c6e1155dd6d61488aaa2c6a82ae
parent8630a6230da60b4f52db4b419fcc0cb4535b3bd1 (diff)
downloadtcl-7face33ee236bd41dc1aa0b476b04d4d1e512cbe.zip
tcl-7face33ee236bd41dc1aa0b476b04d4d1e512cbe.tar.gz
tcl-7face33ee236bd41dc1aa0b476b04d4d1e512cbe.tar.bz2
* tclWinThrd.c: Revisited _beginthreadex() stuff. Instead of assuming
a c-runtime implimentation of _beginethreadex normal, I reversed the logic to not assume, and use when is.
-rw-r--r--win/tclWinThrd.c19
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
}