From c4e326675c4755672637659f2cdc844048de4cf9 Mon Sep 17 00:00:00 2001 From: surles Date: Fri, 14 May 1999 23:16:54 +0000 Subject: added intospection variable to determine if the interp was compiled with threads enabled --- ChangeLog | 6 ++++++ generic/tclBasic.c | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c2ffe14..f2f9e7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +1999-05-14 + + * generic/tclBasic.c (Tcl_CreateInterp): Added introspection + variable for threaded interps. If the interp was compiled with + threads enabled, the tcl_platform(threaded) variable will exist. + 1999-05-14 * generic/tclDate.c: Applied patch to fix 100-year and 400-year diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 10d8311..8de3a0d 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.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: tclBasic.c,v 1.20 1999/05/13 01:50:32 stanton Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.21 1999/05/14 23:16:54 surles Exp $ */ #include "tclInt.h" @@ -529,6 +529,19 @@ Tcl_CreateInterp() TclPrecTraceProc, (ClientData) NULL); TclpSetVariables(interp); +#ifdef TCL_THREADS + /* + * The existence of the "threaded" element of the tcl_platform array indicates + * that this particular Tcl shell has been compiled with threads turned on. + * Using "info exists tcl_platform(threaded)" a Tcl script can introspect on the + * interpreter level of thread safety. + */ + + + Tcl_SetVar2(interp, "tcl_platform", "threaded", "1", + TCL_GLOBAL_ONLY); +#endif + /* * Register Tcl's version number. */ -- cgit v0.12