summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-07-17 01:45:30 (GMT)
committerhobbs <hobbs>2001-07-17 01:45:30 (GMT)
commit69695c3c8e2ec08c505eb65ef119b3bb808dd79e (patch)
tree2b602ea67676237c8e70479584e196c88a3a31d4 /win
parent8f4363d663ad2c86b3545d4445cc193702871fb7 (diff)
downloadtcl-69695c3c8e2ec08c505eb65ef119b3bb808dd79e.zip
tcl-69695c3c8e2ec08c505eb65ef119b3bb808dd79e.tar.gz
tcl-69695c3c8e2ec08c505eb65ef119b3bb808dd79e.tar.bz2
* win/tclWinPipe.c (PipeClose2Proc): constrained the mutex lock to
just the TerminateThread call and waiting for termination. (jsmith)
Diffstat (limited to 'win')
-rw-r--r--win/tclWinPipe.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 0cc215c..00635cf 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.16 2001/07/16 23:30:16 mdejong Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.17 2001/07/17 01:45:30 hobbs Exp $
*/
#include "tclWinInt.h"
@@ -1824,14 +1824,6 @@ PipeClose2Proc(
if (pipePtr->readThread) {
/*
- * Note that we need to guard against terminating the thread while
- * it is in the middle of Tcl_ThreadAlert because it won't be able
- * to release the notifier lock.
- */
-
- Tcl_MutexLock(&pipeMutex);
-
- /*
* The thread may already have closed on it's own. Check it's
* exit code.
*/
@@ -1856,24 +1848,31 @@ PipeClose2Proc(
if (exitCode == STILL_ACTIVE) {
/*
- * The thread must be blocked waiting for the pipe to become
- * readable in ReadFile(). There isn't a clean way to exit
- * the thread from this condition. We should terminate the
- * child process instead to get the reader thread to fall out of
- * ReadFile with a FALSE. (below) is not the correct way to do
- * this, but will stay here until a better solution is found.
+ * The thread must be blocked waiting for the pipe to
+ * become readable in ReadFile(). There isn't a clean way
+ * to exit the thread from this condition. We should
+ * terminate the child process instead to get the reader
+ * thread to fall out of ReadFile with a FALSE. (below) is
+ * not the correct way to do this, but will stay here until
+ * a better solution is found.
+ *
+ * Note that we need to guard against terminating the
+ * thread while it is in the middle of Tcl_ThreadAlert
+ * because it won't be able to release the notifier lock.
*/
+ Tcl_MutexLock(&pipeMutex);
+
/* BUG: this leaks memory */
TerminateThread(pipePtr->readThread, 0);
/* Wait for the thread to terminate. */
WaitForSingleObject(pipePtr->readThread, INFINITE);
+
+ Tcl_MutexUnlock(&pipeMutex);
}
}
- Tcl_MutexUnlock(&pipeMutex);
-
CloseHandle(pipePtr->readThread);
CloseHandle(pipePtr->readable);
CloseHandle(pipePtr->startReader);