summaryrefslogtreecommitdiffstats
path: root/win/tclWinPipe.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-04-05 19:52:23 (GMT)
committersebres <sebres@users.sourceforge.net>2017-04-05 19:52:23 (GMT)
commit9bb9d59d856e33313c1f34ec3eb2ac1e0bc145c5 (patch)
treeb7f09e8cc0487921bd391309b69ba533825b0277 /win/tclWinPipe.c
parent21c607d91ac4d1bd5fbe8820ec592293970c347f (diff)
downloadtcl-9bb9d59d856e33313c1f34ec3eb2ac1e0bc145c5.zip
tcl-9bb9d59d856e33313c1f34ec3eb2ac1e0bc145c5.tar.gz
tcl-9bb9d59d856e33313c1f34ec3eb2ac1e0bc145c5.tar.bz2
the same handling to initialize thread without suspend/resume helpers (otherwise may be dangerous by very huge resp. too busy system);
Diffstat (limited to 'win/tclWinPipe.c')
-rw-r--r--win/tclWinPipe.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index fce039c..523d4eb 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -1638,11 +1638,11 @@ TclpCreateCommandChannel(
*/
if (wEventsCnt) {
WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000);
- /* Resume both waiting threads */
+ /* Resume both waiting threads, we've get the events */
if (infoPtr->readThread)
- ResumeThread(infoPtr->readThread);
+ SetEvent(infoPtr->stopReader);
if (infoPtr->writeThread)
- ResumeThread(infoPtr->writeThread);
+ SetEvent(infoPtr->stopWriter);
}
/*
@@ -2879,8 +2879,8 @@ PipeReaderThread(
/*
* Notify caller that this thread has been initialized
*/
- SetEvent(infoPtr->startReader);
- SuspendThread(infoPtr->readThread); /* until main thread get an event */
+ SignalObjectAndWait(infoPtr->startReader, infoPtr->stopReader, INFINITE, FALSE);
+ ResetEvent(infoPtr->stopReader); /* not auto-reset */
wEvents[0] = infoPtr->stopReader;
wEvents[1] = infoPtr->startReader;
@@ -3015,8 +3015,8 @@ PipeWriterThread(
/*
* Notify caller that this thread has been initialized
*/
- SetEvent(infoPtr->startWriter);
- SuspendThread(infoPtr->writeThread); /* until main thread get an event */
+ SignalObjectAndWait(infoPtr->startWriter, infoPtr->stopWriter, INFINITE, FALSE);
+ ResetEvent(infoPtr->stopWriter); /* not auto-reset */
wEvents[0] = infoPtr->stopWriter;
wEvents[1] = infoPtr->startWriter;