Subject: Fix [3611974]: InitSubsystems multiple thread issue

From: "jan.nijtmans" <[email-masked]>
Date: Tue, 18 Jun 2013 10:33:33 +0000

---
 ChangeLog          |  4 ++++
 generic/tclEvent.c | 13 ++++---------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 54c3b99..247dca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-06-18  Jan Nijtmans  <[email-masked]>
+
+	* generic/tclEvent.c: Bug [3611974]: InitSubsystems multiple thread issue.
+
 2013-06-17  Jan Nijtmans  <[email-masked]>
 
 	* generic/regc_locale.c: Bug [a876646efe]: re_expr character class
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 7daa7bb..d98685a 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -949,14 +949,8 @@ TclInitSubsystems(void)
 
 	TclpInitLock();
 	if (subsystemsInitialized == 0) {
-	    /*
-	     * Have to set this bit here to avoid deadlock with the routines
-	     * below us that call into TclInitSubsystems.
-	     */
-
-	    subsystemsInitialized = 1;
 
-	    /*
+		/*
 	     * Initialize locks used by the memory allocators before anything
 	     * interesting happens so we can use the allocators in the
 	     * implementation of self-initializing locks.
@@ -974,12 +968,13 @@ TclInitSubsystems(void)
 	    TclpInitPlatform();		/* Creates signal handler(s) */
 	    TclInitDoubleConversion();	/* Initializes constants for
 					 * converting to/from double. */
-    	    TclInitObjSubsystem();	/* Register obj types, create
+	    TclInitObjSubsystem();	/* Register obj types, create
 					 * mutexes. */
 	    TclInitIOSubsystem();	/* Inits a tsd key (noop). */
 	    TclInitEncodingSubsystem();	/* Process wide encoding init. */
 	    TclpSetInterfaces();
-    	    TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */
+	    TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */
+	    subsystemsInitialized = 1;
 	}
 	TclpInitUnlock();
     }
-- 
cgit v0.12