summaryrefslogtreecommitdiff
path: root/pthread/pt-alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'pthread/pt-alloc.c')
-rw-r--r--pthread/pt-alloc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pthread/pt-alloc.c b/pthread/pt-alloc.c
index 89fca8a..604d376 100644
--- a/pthread/pt-alloc.c
+++ b/pthread/pt-alloc.c
@@ -75,6 +75,10 @@ initialize_pthread (struct __pthread *new, int recycling)
new->cancelation_handlers = 0;
+#ifdef ENABLE_TLS
+ new->tcb = NULL;
+#endif
+
new->next = 0;
new->prevp = 0;
@@ -119,6 +123,15 @@ __pthread_alloc (struct __pthread **pthread)
cases, we are interrupt it. */
__pthread_thread_halt (new);
+#ifdef ENABLE_TLS
+ if (new->tcb)
+ {
+ /* Drop old values */
+ _dl_deallocate_tls (new->tcb, 1);
+ new->tcb = NULL;
+ }
+#endif /* ENABLE_TLS */
+
err = initialize_pthread (new, 1);
if (! err)
*pthread = new;