diff options
author | hobbs <hobbs> | 2001-04-03 22:54:36 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-04-03 22:54:36 (GMT) |
commit | b3050df2ed4146814b006f097962ac61f04d15bc (patch) | |
tree | fea9fa3b3e3b2f751ae7af5de5f61cdbaa2336bd /generic/tclEvent.c | |
parent | a5516756e85b9ab8ccdf5b2db69fdc1f76fb2618 (diff) | |
download | tcl-b3050df2ed4146814b006f097962ac61f04d15bc.zip tcl-b3050df2ed4146814b006f097962ac61f04d15bc.tar.gz tcl-b3050df2ed4146814b006f097962ac61f04d15bc.tar.bz2 |
see backport log in ChangeLog for specific file backports from 8.4aCVS
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r-- | generic/tclEvent.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c index ce43e94..bb0323e 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.8 2000/04/18 23:10:04 hobbs Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.8.2.1 2001/04/03 22:54:37 hobbs Exp $ */ #include "tclInt.h" @@ -99,6 +99,11 @@ typedef struct ThreadSpecificData { static Tcl_ThreadDataKey dataKey; /* + * Common string for the library path for sharing across threads. + */ +char *tclLibraryPathStr; + +/* * Prototypes for procedures referenced only in this file: */ @@ -596,6 +601,12 @@ TclSetLibraryPath(pathPtr) Tcl_DecrRefCount(tsdPtr->tclLibraryPath); } tsdPtr->tclLibraryPath = pathPtr; + + /* + * No mutex locking is needed here as up the stack we're within + * TclpInitLock(). + */ + tclLibraryPathStr = Tcl_GetStringFromObj(pathPtr, NULL); } /* @@ -619,6 +630,17 @@ Tcl_Obj * TclGetLibraryPath() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + + if (tsdPtr->tclLibraryPath == NULL) { + /* + * Grab the shared string and place it into a new thread specific + * Tcl_Obj. + */ + tsdPtr->tclLibraryPath = Tcl_NewStringObj(tclLibraryPathStr, -1); + + /* take ownership */ + Tcl_IncrRefCount(tsdPtr->tclLibraryPath); + } return tsdPtr->tclLibraryPath; } @@ -744,10 +766,11 @@ Tcl_Finalize() ThreadSpecificData *tsdPtr; TclpInitLock(); - tsdPtr = TCL_TSD_INIT(&dataKey); if (subsystemsInitialized != 0) { subsystemsInitialized = 0; + tsdPtr = TCL_TSD_INIT(&dataKey); + /* * Invoke exit handlers first. */ |