summaryrefslogtreecommitdiff
path: root/libpthread/pthread/pt-create.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2011-10-30 20:14:18 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-10-30 20:14:18 +0100
commitd88d71c54992e93c812ad33bb2b9962c71a78fd7 (patch)
treee478d8999e5a87dff31653c8d4a7ff6e828bfc64 /libpthread/pthread/pt-create.c
parent62e8551e80d71082c6e2ae74cca0b1a157beedce (diff)
parent10c4673df9e51862737285c87270245e025c8c1f (diff)
Merge branch 'upstream-merged'
Diffstat (limited to 'libpthread/pthread/pt-create.c')
-rw-r--r--libpthread/pthread/pt-create.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpthread/pthread/pt-create.c b/libpthread/pthread/pt-create.c
index 8f62b78e..346c6979 100644
--- a/libpthread/pthread/pt-create.c
+++ b/libpthread/pthread/pt-create.c
@@ -129,6 +129,13 @@ __pthread_create_internal (struct __pthread **thread,
if (err)
goto failed_thread_alloc;
+#ifdef ENABLE_TLS
+ pthread->tcb = _dl_allocate_tls (NULL);
+ if (!pthread->tcb)
+ goto failed_thread_tls_alloc;
+ pthread->tcb->tcb = pthread->tcb;
+#endif /* ENABLE_TLS */
+
/* And initialize the rest of the machine context. This may include
additional machine- and system-specific initializations that
prove convenient. */
@@ -194,6 +201,10 @@ __pthread_create_internal (struct __pthread **thread,
failed_sigstate:
__pthread_sigstate_destroy (pthread);
failed_setup:
+#ifdef ENABLE_TLS
+ _dl_deallocate_tls (pthread->tcb, 1);
+ failed_thread_tls_alloc:
+#endif /* ENABLE_TLS */
__pthread_thread_dealloc (pthread);
__pthread_thread_halt (pthread);
failed_thread_alloc: