diff options
| author | zv@archiware.com <vasiljevic> | 2006-03-10 14:12:14 (GMT) |
|---|---|---|
| committer | zv@archiware.com <vasiljevic> | 2006-03-10 14:12:14 (GMT) |
| commit | cebfd8111a9a64fb9172115325e654a3a47813fa (patch) | |
| tree | 10dcb5a16f60d7e3919e79c01a78f3cda89976ee /generic/tclIO.c | |
| parent | f9f343b1acaeac4a1ca87a177a19150e9b302830 (diff) | |
| download | tcl-cebfd8111a9a64fb9172115325e654a3a47813fa.zip tcl-cebfd8111a9a64fb9172115325e654a3a47813fa.tar.gz tcl-cebfd8111a9a64fb9172115325e654a3a47813fa.tar.bz2 | |
Invokes TclpFinalizeSockets() as part of the TclFinalizeIOSubsystem() call.
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(); } |
