diff options
author | hobbs <hobbs> | 2008-01-14 00:11:43 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2008-01-14 00:11:43 (GMT) |
commit | 76f1d4978fd92cb38fda81d74286a6f0f21f44b5 (patch) | |
tree | 6bf73270a180efb8fb88a4efcce1bdb15b9eb335 | |
parent | b98ee2e66d8f576ab0efe7986faf70a0aada8836 (diff) | |
download | tcl-76f1d4978fd92cb38fda81d74286a6f0f21f44b5.zip tcl-76f1d4978fd92cb38fda81d74286a6f0f21f44b5.tar.gz tcl-76f1d4978fd92cb38fda81d74286a6f0f21f44b5.tar.bz2 |
* win/tclWinSerial.c (SerialCloseProc, TclWinOpenSerialChannel):
use critical section for read & write side. [Bug 1353846] (newman)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win/tclWinSerial.c | 7 |
2 files changed, 9 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2008-01-13 Jeff Hobbs <jeffh@ActiveState.com> + + * win/tclWinSerial.c (SerialCloseProc, TclWinOpenSerialChannel): + use critical section for read & write side. [Bug 1353846] (newman) + 2008-01-11 Miguel Sofer <msofer@users.sf.net> * unix/tclUnixThrd.c (TclpThreadGetStackSize): restore stack diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 7a4ee94..39c7e05 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,7 +11,7 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.35 2007/04/20 06:11:00 kennykb Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.36 2008/01/14 00:11:44 hobbs Exp $ */ #include "tclWinInt.h" @@ -662,7 +662,6 @@ SerialCloseProc( CloseHandle(serialPtr->writeThread); CloseHandle(serialPtr->osWrite.hEvent); - DeleteCriticalSection(&serialPtr->csWrite); CloseHandle(serialPtr->evWritable); CloseHandle(serialPtr->evStartWriter); CloseHandle(serialPtr->evStopWriter); @@ -672,6 +671,8 @@ SerialCloseProc( } serialPtr->validMask &= ~TCL_WRITABLE; + DeleteCriticalSection(&serialPtr->csWrite); + /* * Don't close the Win32 handle if the handle is a standard channel during * the thread exit process. Otherwise, one thread may kill the stdio of @@ -1520,6 +1521,7 @@ TclWinOpenSerialChannel( SetCommTimeouts(handle, &no_timeout); + InitializeCriticalSection(&infoPtr->csWrite); if (permissions & TCL_READABLE) { infoPtr->osRead.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); } @@ -1532,7 +1534,6 @@ TclWinOpenSerialChannel( infoPtr->evWritable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->evStartWriter = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->evStopWriter = CreateEvent(NULL, FALSE, FALSE, NULL); - InitializeCriticalSection(&infoPtr->csWrite); infoPtr->writeThread = CreateThread(NULL, 256, SerialWriterThread, infoPtr, 0, &id); } |