]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make sure init_global_thread_specific_state() set the global_init_done
authorTom Hughes <tom@compton.nu>
Sat, 17 Jul 2004 11:08:03 +0000 (11:08 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 17 Jul 2004 11:08:03 +0000 (11:08 +0000)
flag before the call to __uselocale() in order to avoid deadlock.

CCMAIL: 77952-done@bugs.kde.org

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2493

coregrind/vg_libpthread.c

index 32a035a730a27392e7d5feba28c25fad3c767c7a..c76c530c2db14cbceed70a73f0dbd64fae1d2490 100644 (file)
@@ -2043,12 +2043,19 @@ init_global_thread_specific_state ( void )
    /* assert that we are the root thread. */
    my_assert(pthread_self() == 1);
 
+   /* Signify init done - we shouldn't really do this until after
+      the call to init_thread_specific_state() but that routine makes
+      a call to __uselocale() that may bring us back here as that
+      routine will call __libc_tsd_set() which will call us.
+
+      We can get away with marking the init as done now because
+      the important bits of init_thread_specific_state() are done
+      before the call to __uselocale() is made. */
+   global_init_done = 1;
+
    /* Initialise thread specific data for the root thread. */
    init_thread_specific_state();
 
-   /* Signify init done. */
-   global_init_done = 1;
-
    /* Install a cleanup routine to handle the root thread exiting */
    _pthread_cleanup_push(NULL, cleanup_root, NULL);