(__pthread_initialize_manager): Lock __pthread_manager_thread.p_lock
[kopensolaris-gnu/glibc.git] / linuxthreads / pthread.c
index d70e3f4..c264da5 100644 (file)
@@ -450,6 +450,8 @@ int __pthread_initialize_manager(void)
                   | __pthread_initial_thread.p_eventbuf.eventmask.event_bits[idx]))
          != 0)
        {
+         __pthread_lock(__pthread_manager_thread.p_lock, NULL);
+
 #ifdef NEED_SEPARATE_REGISTER_STACK
          pid = __clone2(__pthread_manager_event,
                         (void **) __pthread_manager_thread_bos,
@@ -478,10 +480,10 @@ int __pthread_initialize_manager(void)
 
              /* Now call the function which signals the event.  */
              __linuxthreads_create_event ();
-
-             /* Now restart the thread.  */
-             __pthread_unlock(__pthread_manager_thread.p_lock);
            }
+
+         /* Now restart the thread.  */
+         __pthread_unlock(__pthread_manager_thread.p_lock);
        }
     }