Skip to content
Tcl Source Code Attachment Details
Login

Attachment Details

Overview

Artifact ID: 29fb701a96b7cac72ddc167e00847c7b48eae596
Ticket: 859820ffffffffffffffffffffffffffffffffff
Date: 2004-01-21 16:18:32
User: davygrvy
Artifact Attached: 1603f60547bcd81ca0e81601f0c1089d533829ce
Filename:patch.txt
Description:diff between r1.39 and r1.40 of tclWinPipe.c
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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
*** tclWinPipe.c	24 Dec 2003 04:18:23 -0000	1.39
--- tclWinPipe.c	20 Jan 2004 05:18:22 -0000	1.40
***************
*** 906,911 ****
--- 906,913 ----
  {
      ProcInfo *infoPtr;
  
+     PipeInit();
+ 
      Tcl_MutexLock(&pipeMutex);
      for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) {
  	if (infoPtr->hProcess == (HANDLE) pid) {
***************
*** 2485,2491 ****
      int *statPtr,
      int options)
  {
!     ProcInfo *infoPtr, **prevPtrPtr;
      DWORD flags;
      Tcl_Pid result;
      DWORD ret, exitCode;
--- 2487,2493 ----
      int *statPtr,
      int options)
  {
!     ProcInfo *infoPtr = NULL, **prevPtrPtr;
      DWORD flags;
      Tcl_Pid result;
      DWORD ret, exitCode;
***************
*** 2502,2508 ****
      }
  
      /*
!      * Find the process on the process list.
       */
  
      Tcl_MutexLock(&pipeMutex);
--- 2504,2510 ----
      }
  
      /*
!      * Find the process and cut it from the process list.
       */
  
      Tcl_MutexLock(&pipeMutex);
***************
*** 2510,2515 ****
--- 2512,2518 ----
      for (infoPtr = procList; infoPtr != NULL;
  	    prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) {
  	 if (infoPtr->hProcess == (HANDLE) pid) {
+ 	    *prevPtrPtr = infoPtr->nextPtr;
  	    break;
  	}
      }
***************
*** 2539,2544 ****
--- 2542,2554 ----
      if (ret == WAIT_TIMEOUT) {
  	*statPtr = 0;
  	if (options & WNOHANG) {
+ 	    /*
+ 	     * Re-insert this infoPtr back on the list.
+ 	     */
+ 	    Tcl_MutexLock(&pipeMutex);
+ 	    infoPtr->nextPtr = procList;
+ 	    procList = infoPtr;
+ 	    Tcl_MutexUnlock(&pipeMutex);
  	    return 0;
  	} else {
  	    result = 0;
***************
*** 2601,2611 ****
      }
  
      /*
!      * Remove the process from the process list and close the process handle.
       */
  
      CloseHandle(infoPtr->hProcess);
-     *prevPtrPtr = infoPtr->nextPtr;
      ckfree((char*)infoPtr);
  
      return result;
--- 2611,2620 ----
      }
  
      /*
!      * Officially close the process handle.
       */
  
      CloseHandle(infoPtr->hProcess);
      ckfree((char*)infoPtr);
  
      return result;