summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2005-10-04 18:32:47 (GMT)
committervasiljevic <zv@archiware.com>2005-10-04 18:32:47 (GMT)
commit3a1cc7cd8ece0078e527499a541f9d4703012d95 (patch)
treeb4c2c00e5472ff645168de6c1677deb572d4b904 /generic/tclIO.c
parent0ee7072e5fb4230554c40aa7eb13a3cf19719b82 (diff)
downloadtcl-3a1cc7cd8ece0078e527499a541f9d4703012d95.zip
tcl-3a1cc7cd8ece0078e527499a541f9d4703012d95.tar.gz
tcl-3a1cc7cd8ece0078e527499a541f9d4703012d95.tar.bz2
Tcl_ClearChannelHandlers(): now deletes any outstanding
timer for the channel. Also, prevents events still in the event queue from triggering on the current channel.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index b08e358..fe6dc24 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.94 2005/08/26 22:11:16 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.95 2005/10/04 18:32:47 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -2880,6 +2880,12 @@ Tcl_ClearChannelHandlers(channel)
chanPtr = statePtr->topChanPtr;
/*
+ * Cancel any outstanding timer.
+ */
+
+ Tcl_DeleteTimerHandler(statePtr->timer);
+
+ /*
* Remove any references to channel handlers for this channel that may be
* about to be invoked.
*/
@@ -2912,13 +2918,19 @@ Tcl_ClearChannelHandlers(channel)
StopCopy(statePtr->csPtr);
/*
- * Must set the interest mask now to 0, otherwise infinite loops will
- * occur if Tcl_DoOneEvent is called before the channel is finally deleted
- * in FlushChannel. This can happen if the channel has a background flush
- * active.
+ * Must set the interest mask now to 0, otherwise infinite loops
+ * will occur if Tcl_DoOneEvent is called before the channel is
+ * finally deleted in FlushChannel. This can happen if the channel
+ * has a background flush active.
+ * Also, delete all registered file handlers for this channel
+ * (and for the current thread). This prevents executing of pending
+ * file-events still sitting in the event queue of the current thread.
+ * We deliberately do not call UpdateInterest() because this could
+ * re-schedule new events if the channel still needs to be flushed.
*/
-
+
statePtr->interestMask = 0;
+ (chanPtr->typePtr->watchProc)(chanPtr->instanceData, 0);
/*
* Remove any EventScript records for this channel.