Skip to content
Tcl Source Code Attachment Details
Login

Attachment Details

Overview

Artifact ID: 6371640d9de6e7139d6760d06ed6a3f97b90bcaa
Ticket: 418737ffffffffffffffffffffffffffffffffff
Date: 2001-04-25 13:53:15
User: davygrvy
Artifact Attached: b4d599682d3bb33c581ff0df21115d1afe8540c4
Filename:patch_some_mingw_support.txt
Description:
Content:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
Index: tclWinThrd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinThrd.c,v
retrieving revision 1.11
diff -c -r1.11 tclWinThrd.c
*** tclWinThrd.c	2000/06/13 20:30:24	1.11
--- tclWinThrd.c	2001/04/25 06:44:59
***************
*** 136,143 ****
  
      EnterCriticalSection(&joinLock);
  
      code = _beginthreadex(NULL, (unsigned) stackSize, proc, clientData, 0,
! 	(unsigned *)idPtr);
  
      if (code == 0) {
          LeaveCriticalSection(&joinLock);
--- 136,156 ----
  
      EnterCriticalSection(&joinLock);
  
+ #if !defined(__GNUC__) || (defined(__GNUC__) && defined(__MSVCRT__))
      code = _beginthreadex(NULL, (unsigned) stackSize, proc, clientData, 0,
! 	    (unsigned *)idPtr);
! #else
!     /* 
!      * MS CRTDLL runtime, one of two supported GCC/Mingw, does not support 
!      * the _beginthreadex and _endthreadex interfaces, and we resort to using
!      * Win32 API CreateThread and ExitThread interfaces instead. A side 
!      * effect is that there is a potential resource leak after each thread 
!      * exits. 
!      */
! 
!     code = (unsigned long) CreateThread(NULL, (unsigned) stackSize, proc,
! 	    clientData, 0, (DWORD *)idPtr);
! #endif
  
      if (code == 0) {
          LeaveCriticalSection(&joinLock);
***************
*** 200,209 ****
      int status;
  {
      EnterCriticalSection(&joinLock);
!     TclSignalExitThread (Tcl_GetCurrentThread (), status);
      LeaveCriticalSection(&joinLock);
  
      _endthreadex((DWORD)status);
  }
  
  
--- 213,226 ----
      int status;
  {
      EnterCriticalSection(&joinLock);
!     TclSignalExitThread (Tcl_GetCurrentThread(), status);
      LeaveCriticalSection(&joinLock);
  
+ #if !defined(__GNUC__) || (defined(__GNUC__) && defined(__MSVCRT__))
      _endthreadex((DWORD)status);
+ #else
+     ExitThread((DWORD)status);
+ #endif
  }