Attachment "createthread.patch" to
ticket [444255ffff]
added by
mdejong
2001-07-25 03:37:48.
2001-07-24 Mo DeJong <[email protected]>
* win/tclWinThrd.c (Tcl_CreateThread, TclpThreadExit):
When building under Cygwin, call CreateThread instead
of _beginthreadex and call ExitThread instead of
_endthreadex. Cygwin does not support these msvcrt
methods and does not suffer from the memory leak
problems that prompted their use.
Index: win/tclWinThrd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinThrd.c,v
retrieving revision 1.13
diff -u -r1.13 tclWinThrd.c
--- win/tclWinThrd.c 2001/07/24 19:47:02 1.13
+++ win/tclWinThrd.c 2001/07/24 20:33:05
@@ -135,10 +135,16 @@
EnterCriticalSection(&joinLock);
+#ifdef __CYGWIN__
+ tHandle = CreateThread(NULL, (DWORD) stackSize,
+ (LPTHREAD_START_ROUTINE) proc, (LPVOID) clientData,
+ (DWORD) 0, (LPDWORD)idPtr);
+ if (tHandle == NULL) {
+#else
tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, proc,
- clientData, 0, (unsigned *)idPtr);
-
+ clientData, (unsigned) 0, (unsigned *)idPtr);
if (tHandle == 0) {
+#endif /* __CYGWIN__ */
LeaveCriticalSection(&joinLock);
return TCL_ERROR;
} else {
@@ -203,7 +209,11 @@
TclSignalExitThread (Tcl_GetCurrentThread (), status);
LeaveCriticalSection(&joinLock);
- _endthreadex((DWORD)status);
+#ifdef __CYGWIN__
+ ExitThread((DWORD) status);
+#else
+ _endthreadex((unsigned) status);
+#endif /* __CYGWIN__ */
}