summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2006-03-10 14:12:14 (GMT)
committervasiljevic <zv@archiware.com>2006-03-10 14:12:14 (GMT)
commit27a60bbb6e8ed74aee449f6f51e1bade58953942 (patch)
tree10dcb5a16f60d7e3919e79c01a78f3cda89976ee
parent22be60059b2287091988d9439c16c781377358ef (diff)
downloadtcl-27a60bbb6e8ed74aee449f6f51e1bade58953942.zip
tcl-27a60bbb6e8ed74aee449f6f51e1bade58953942.tar.gz
tcl-27a60bbb6e8ed74aee449f6f51e1bade58953942.tar.bz2
Invokes TclpFinalizeSockets() as part of the TclFinalizeIOSubsystem() call.
-rw-r--r--generic/tclIO.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 852af2b..c7c2e3f 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.61.2.18 2006/02/15 16:04:27 dgp Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.61.2.19 2006/03/10 14:12:14 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -185,7 +185,7 @@ TclInitIOSubsystem()
*
* TclFinalizeIOSubsystem --
*
- * Releases all resources used by this subsystem on a per-process
+ * Releases all resources used by this subsystem on a per-thread
* basis. Closes all extant channels that have not already been
* closed because they were not owned by any interp.
*
@@ -207,6 +207,11 @@ TclFinalizeIOSubsystem()
ChannelState *nextCSPtr; /* Iterates over open channels. */
ChannelState *statePtr; /* state of channel stack */
+ /*
+ * Walk all channel state structures known to this thread and
+ * close corresponding channels.
+ */
+
for (statePtr = tsdPtr->firstCSPtr; statePtr != (ChannelState *) NULL;
statePtr = nextCSPtr) {
chanPtr = statePtr->topChanPtr;
@@ -234,7 +239,9 @@ TclFinalizeIOSubsystem()
* Preserve statePtr from disappearing until we can get the
* nextCSPtr below.
*/
+
Tcl_Preserve(statePtr);
+
if (statePtr->refCount <= 0) {
/*
@@ -244,7 +251,9 @@ TclFinalizeIOSubsystem()
*/
(void) Tcl_Close((Tcl_Interp *) NULL, (Tcl_Channel) chanPtr);
+
} else {
+
/*
* The refcount is greater than zero, so flush the channel.
*/
@@ -274,13 +283,17 @@ TclFinalizeIOSubsystem()
chanPtr->instanceData = (ClientData) NULL;
statePtr->flags |= CHANNEL_DEAD;
}
+
/*
* We look for the next pointer now in case we had one closed on up
* during the current channel's closeproc (eg: rechan extension)
*/
+
nextCSPtr = statePtr->nextCSPtr;
Tcl_Release(statePtr);
- }
+ }
+
+ TclpFinalizeSockets();
TclpFinalizePipes();
}