summaryrefslogtreecommitdiff
path: root/nptl/pthread_create.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-03-09 20:21:12 -0800
committerUlrich Drepper <drepper@redhat.com>2010-03-09 20:21:12 -0800
commit1d78f2996dc94c04578e83d1df221811fbe13fc7 (patch)
tree5c892d27f0be3ad2bd7f444bc95aa5091e5311cb /nptl/pthread_create.c
parent462a5227b0d3220ab68f65272bd5b9d6d4f49b1f (diff)
Fix a few more problem with the recent setxid changes.
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r--nptl/pthread_create.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 14e3cf784b..34d83f94ad 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -537,33 +537,23 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
if (pd->schedparam.sched_priority < minprio
|| pd->schedparam.sched_priority > maxprio)
{
- err = EINVAL;
- goto errout;
+ /* Perhaps a thread wants to change the IDs and if waiting
+ for this stillborn thread. */
+ if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0)
+ == -2, 0))
+ lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE);
+
+ __deallocate_stack (pd);
+
+ return EINVAL;
}
}
/* Pass the descriptor to the caller. */
*newthread = (pthread_t) pd;
- /* Remember whether the thread is detached or not. In case of an
- error we have to free the stacks of non-detached stillborn
- threads. */
- bool is_detached = IS_DETACHED (pd);
-
/* Start the thread. */
- err = create_thread (pd, iattr, STACK_VARIABLES_ARGS);
- if (err != 0)
- {
- /* Something went wrong. Free the resources. */
- if (!is_detached)
- {
- errout:
- __deallocate_stack (pd);
- }
- return err;
- }
-
- return 0;
+ return create_thread (pd, iattr, STACK_VARIABLES_ARGS);
}
versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);