summaryrefslogtreecommitdiffstats
path: root/generic/tclEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r--generic/tclEvent.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 713ef30..270e11b 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -12,7 +12,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.62 2005/08/10 16:28:02 kennykb Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.63 2005/08/11 22:06:47 kennykb Exp $
*/
#include "tclInt.h"
@@ -782,6 +782,8 @@ TclInitSubsystems()
* implementation of self-initializing locks.
*/
+ TclInitThreadStorage(); /* Creates master hash table for
+ * thread local storage */
#if USE_TCLALLOC
TclInitAlloc(); /* Process wide mutex init */
#endif
@@ -952,6 +954,23 @@ Tcl_Finalize()
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
TclFinalizeThreadAlloc();
#endif
+ /*
+ * We defer unloading of packages until very late to avoid memory
+ * access issues. Both exit callbacks and synchronization variables
+ * may be stored in packages.
+ *
+ * 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.
+ */
+
+ TclFinalizeLoad();
+ TclResetFilesystem();
/*
* We defer unloading of packages until very late to avoid memory
@@ -1002,6 +1021,13 @@ void
Tcl_FinalizeThread()
{
ExitHandler *exitPtr;
+
+ /*
+ * We use TclThreadDataKeyGet here, rather than Tcl_GetThreadData,
+ * because we don't want to initialize the data block if it hasn't
+ * been initialized already.
+ */
+
ThreadSpecificData *tsdPtr =
(ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);