summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-04-02 08:35:02 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-04-02 08:35:02 (GMT)
commitfa9b84b398d88714ceaa6410047ccead8f15b1c3 (patch)
tree6c311f934b214fb68689da2ca8b01aedd8198f18 /win/tclWinSock.c
parentc12228d755f6bbc24681d68ad69ae7b7dfde5ba4 (diff)
downloadtcl-fa9b84b398d88714ceaa6410047ccead8f15b1c3.zip
tcl-fa9b84b398d88714ceaa6410047ccead8f15b1c3.tar.gz
tcl-fa9b84b398d88714ceaa6410047ccead8f15b1c3.tar.bz2
Set all variables written by the notifier thread as volatile.
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 6633b89..e7b086a 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -98,29 +98,31 @@ static ProcessGlobalValue hostName = {
/*
* The following structure is used to store the data associated with each
* socket.
+ * All members modified by the notifier thread are defined as volatile.
*/
typedef struct SocketInfo {
Tcl_Channel channel; /* Channel associated with this socket. */
SOCKET socket; /* Windows SOCKET handle. */
- int flags; /* Bit field comprised of the flags described
+ volatile int flags; /* Bit field comprised of the flags described
* below. */
int watchEvents; /* OR'ed combination of FD_READ, FD_WRITE,
* FD_CLOSE, FD_ACCEPT and FD_CONNECT that
* indicate which events are interesting. */
- int readyEvents; /* OR'ed combination of FD_READ, FD_WRITE,
+ volatile int readyEvents; /* OR'ed combination of FD_READ, FD_WRITE,
* FD_CLOSE, FD_ACCEPT and FD_CONNECT that
* indicate which events have occurred. */
int selectEvents; /* OR'ed combination of FD_READ, FD_WRITE,
* FD_CLOSE, FD_ACCEPT and FD_CONNECT that
* indicate which events are currently being
* selected. */
- int acceptEventCount; /* Count of the current number of FD_ACCEPTs
+ volatile int acceptEventCount;
+ /* Count of the current number of FD_ACCEPTs
* that have arrived and not yet processed. */
Tcl_TcpAcceptProc *acceptProc;
/* Proc to call on accept. */
ClientData acceptProcData; /* The data for the accept proc. */
- int lastError; /* Error code from last message. */
+ volatile int lastError; /* Error code from last message. */
struct SocketInfo *nextPtr; /* The next socket on the per-thread socket
* list. */
} SocketInfo;