summaryrefslogtreecommitdiffstats
path: root/generic/tclEvent.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley@noemail.net>2003-02-04 17:06:43 (GMT)
committervincentdarley <vincentdarley@noemail.net>2003-02-04 17:06:43 (GMT)
commit730067510efff07452b36736e70d871f2af30738 (patch)
treec50a993eca73882fec1db93099999bb362cc7278 /generic/tclEvent.c
parentfdff499a2a77365a13406100607235349f0763d8 (diff)
downloadtcl-730067510efff07452b36736e70d871f2af30738.zip
tcl-730067510efff07452b36736e70d871f2af30738.tar.gz
tcl-730067510efff07452b36736e70d871f2af30738.tar.bz2
finalization and test fixes
FossilOrigin-Name: 1bf7a8241117b168c3fb8a4ed4398c3f1317b2fa
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r--generic/tclEvent.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index f56c61d..df1b17a 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEvent.c,v 1.26 2003/01/25 03:12:01 hobbs Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.27 2003/02/04 17:06:49 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -813,6 +813,12 @@ Tcl_Finalize()
TclFinalizeEnvironment();
/*
+ * Finalizing the filesystem must come after anything which
+ * might conceivably interact with the 'Tcl_FS' API.
+ */
+ TclFinalizeFilesystem();
+
+ /*
* We must be sure the encoding finalization doesn't need
* to examine the filesystem in any way. Since it only
* needs to clean up internal data structures, this is
@@ -843,23 +849,23 @@ Tcl_Finalize()
TclFinalizeSynchronization();
/*
- * FIX FIX FIX:
- * There is a conflict here between what apps need when for
- * finalization. There is the encoding note below that
- * relates to tclkits, but there is the clear problem in a
- * standard threaded build that you must finalize the sync
- * objects before the filesystem to handle tsdPtr's in
- * extensions (example: dde). -- hobbs
+ * We defer unloading of packages until very late
+ * to avoid memory access issues. Both exit callbacks and
+ * synchronization variables may be stored in packages.
*
- * Finalizing the filesystem must come after anything which
- * might conceivably interact with the 'Tcl_FS' API. This
- * will also unload any extensions which have been loaded.
- * However, it also needs access to the encoding subsystem
- * during finalization, so that system must still be intact
- * at this point.
+ * Note that TclFinalizeLoad unloads packages in the reverse
+ * of the order they were loaded in (i.e. last to be loaded
+ * is the first to be unloaded). This can be important for
+ * correct unloading when dependencies exist.
+ *
+ * Once load has been finalized, we will have deleted any
+ * temporary copies of shared libraries and can therefore
+ * reset the filesystem to its original state.
*/
- TclFinalizeFilesystem();
+ TclFinalizeLoad();
+ TclResetFilesystem();
+
/*
* There shouldn't be any malloc'ed memory after this.
*/