summaryrefslogtreecommitdiff
path: root/pthread/pt-create.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@schwinge.name>2011-10-20 17:04:43 +0200
committerThomas Schwinge <thomas@schwinge.name>2011-10-20 17:07:46 +0200
commit081c7aeb4d4de82ab615db565c60dd776a385c34 (patch)
tree2730963b4c865851b0a17d65d03ba7131245785f /pthread/pt-create.c
parent75f6fe21205a87d1942492cb34e8aab482008a78 (diff)
parent577976c386d89696ec392fdfbb77ea153ddd6588 (diff)
Merge branch 'tls'
Conflicts: ChangeLog Makefile pthread/pt-exit.c pthread/pt-internal.h sysdeps/mach/hurd/ia32/pt-setup.c sysdeps/mach/hurd/pt-docancel.c sysdeps/mach/hurd/pt-sysdep.h
Diffstat (limited to 'pthread/pt-create.c')
-rw-r--r--pthread/pt-create.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pthread/pt-create.c b/pthread/pt-create.c
index 8f62b78..346c697 100644
--- a/pthread/pt-create.c
+++ b/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: