]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(pthread_handle_create): Store ID of new thread before clone call.
authorUlrich Drepper <drepper@redhat.com>
Thu, 23 Mar 2000 22:19:52 +0000 (22:19 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 23 Mar 2000 22:19:52 +0000 (22:19 +0000)
linuxthreads/manager.c

index bc3b03492dabab8a7ace1500b4ac84478943e2be..acb332e4c2856c7db3f512607ed7df6c19d71da8 100644 (file)
@@ -412,6 +412,10 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   new_thread->p_start_args.start_routine = start_routine;
   new_thread->p_start_args.arg = arg;
   new_thread->p_start_args.mask = *mask;
+  /* Make the new thread ID available already now.  If any of the later
+     functions fail we return an error value and the caller must not use
+     the stored thread ID.  */
+  *thread = new_thread_id;
   /* Raise priority of thread manager if needed */
   __pthread_manager_adjust_prio(new_thread->p_priority);
   /* Do the cloning.  We have to use two different functions depending
@@ -484,8 +488,6 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   /* Set pid field of the new thread, in case we get there before the
      child starts. */
   new_thread->p_pid = pid;
-  /* We're all set */
-  *thread = new_thread_id;
   return 0;
 }