summaryrefslogtreecommitdiffstats
path: root/win/tclWinConsole.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/tclWinConsole.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/tclWinConsole.c')
-rw-r--r--win/tclWinConsole.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index 42bc56f..d4893ee 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -1208,8 +1208,7 @@ ConsoleReaderThread(
/*
* Notify caller (using startEvent) that this thread is initialized
*/
- SetEvent(threadInfo->startEvent);
- SuspendThread(threadInfo->thread); /* until main thread get an event */
+ SignalObjectAndWait(threadInfo->startEvent, threadInfo->stopEvent, INFINITE, FALSE);
/*
* The first event takes precedence.
@@ -1321,8 +1320,7 @@ ConsoleWriterThread(
/*
* Notify caller (using startEvent) that this thread is initialized
*/
- SetEvent(threadInfo->startEvent);
- SuspendThread(threadInfo->thread); /* until main thread get an event */
+ SignalObjectAndWait(threadInfo->startEvent, threadInfo->stopEvent, INFINITE, FALSE);
/*
* The first event takes precedence.
@@ -1480,11 +1478,11 @@ TclWinOpenConsoleChannel(
*/
if (wEventsCnt) {
WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000);
- /* Resume both waiting threads */
+ /* Resume both waiting threads, we've get the events */
if (infoPtr->reader.thread)
- ResumeThread(infoPtr->reader.thread);
+ SetEvent(infoPtr->reader.stopEvent);
if (infoPtr->writer.thread)
- ResumeThread(infoPtr->writer.thread);
+ SetEvent(infoPtr->writer.stopEvent);
}
/*
* Files have default translation of AUTO and ^Z eof char, which means