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)
commitceb75ca9ffc56aa82860dae87970bee9d91914f3 (patch)
treeb7f09e8cc0487921bd391309b69ba533825b0277 /win/tclWinPipe.c
parent2ae10f0b3391991adbe6138238681d4d0f3ead11 (diff)
downloadtcl-ceb75ca9ffc56aa82860dae87970bee9d91914f3.zip
tcl-ceb75ca9ffc56aa82860dae87970bee9d91914f3.tar.gz
tcl-ceb75ca9ffc56aa82860dae87970bee9d91914f3.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;