From 8bbd965fdceb67c1ac72e46c7917d09121c43db1 Mon Sep 17 00:00:00 2001 From: davidg Date: Thu, 2 Nov 2000 22:04:54 +0000 Subject: 2000-11-02 David Gravereaux * generic/tclEvent.c: tclLibraryPath Tcl_Obj didn't have a way to share its data among threads. This caused Tcl_Init() to always fail in threads. Added a way to pass the data around with a global char*. [BUG: 5301] --- generic/tclEvent.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index ce43e94..b6715b3 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.9 2000/11/02 22:04:54 davidg 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,7 @@ TclSetLibraryPath(pathPtr) Tcl_DecrRefCount(tsdPtr->tclLibraryPath); } tsdPtr->tclLibraryPath = pathPtr; + tclLibraryPathStr = Tcl_GetStringFromObj(pathPtr, NULL); } /* @@ -619,6 +625,10 @@ Tcl_Obj * TclGetLibraryPath() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + + if (tsdPtr->tclLibraryPath == NULL) { + tsdPtr->tclLibraryPath = Tcl_NewStringObj(tclLibraryPathStr, -1); + } return tsdPtr->tclLibraryPath; } -- cgit v0.12