diff options
author | vasiljevic <vasiljevic@noemail.net> | 2006-03-10 14:12:14 (GMT) |
---|---|---|
committer | vasiljevic <vasiljevic@noemail.net> | 2006-03-10 14:12:14 (GMT) |
commit | 8e5a43a3480d4aa3842afe42ba36594e9df3a2a2 (patch) | |
tree | 10dcb5a16f60d7e3919e79c01a78f3cda89976ee /generic/tclIO.c | |
parent | 351935b3635cdfe9fcc4b59276b7ddc7d398bbe5 (diff) | |
download | tcl-8e5a43a3480d4aa3842afe42ba36594e9df3a2a2.zip tcl-8e5a43a3480d4aa3842afe42ba36594e9df3a2a2.tar.gz tcl-8e5a43a3480d4aa3842afe42ba36594e9df3a2a2.tar.bz2 |
Invokes TclpFinalizeSockets() as part of the TclFinalizeIOSubsystem() call.
FossilOrigin-Name: ab02be49ed29aa07e1949a3adacb7e172e0232e7
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 19 |
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(); } |