summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2008-01-14 00:11:20 (GMT)
committerhobbs <hobbs>2008-01-14 00:11:20 (GMT)
commit96ef6af4e3f9b90258b807aa289715f243e31565 (patch)
tree433cedbb9845e222a81a91f531e61e2629c528dc
parent16a9dc3e86b4bb9846622098b0f602e18fcbb818 (diff)
downloadtcl-96ef6af4e3f9b90258b807aa289715f243e31565.zip
tcl-96ef6af4e3f9b90258b807aa289715f243e31565.tar.gz
tcl-96ef6af4e3f9b90258b807aa289715f243e31565.tar.bz2
* win/tclWinSerial.c (SerialCloseProc, TclWinOpenSerialChannel):
use critical section for read & write side. [Bug 1353846] (newman)
-rw-r--r--ChangeLog5
-rw-r--r--win/tclWinSerial.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e35b5e5..2266329 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
+
2007-12-31 Don Porter <dgp@users.sourceforge.net>
*** 8.4.17 TAGGED FOR RELEASE ***
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 4041a89..263a9b9 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.25.2.3 2005/10/05 06:33:52 hobbs Exp $
+ * RCS: @(#) $Id: tclWinSerial.c,v 1.25.2.4 2008/01/14 00:11:22 hobbs Exp $
*/
#include "tclWinInt.h"
@@ -653,7 +653,6 @@ SerialCloseProc(
CloseHandle(serialPtr->writeThread);
CloseHandle(serialPtr->osWrite.hEvent);
- DeleteCriticalSection(&serialPtr->csWrite);
CloseHandle(serialPtr->evWritable);
CloseHandle(serialPtr->evStartWriter);
CloseHandle(serialPtr->evStopWriter);
@@ -663,6 +662,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
@@ -1467,6 +1468,7 @@ TclWinOpenSerialChannel(handle, channelName, permissions)
*/
SetCommTimeouts(handle, &no_timeout);
+ InitializeCriticalSection(&infoPtr->csWrite);
if (permissions & TCL_READABLE) {
infoPtr->osRead.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -1480,7 +1482,6 @@ TclWinOpenSerialChannel(handle, channelName, permissions)
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);
}