From 96623db8d2fe02a66ac9176354634d41aca8c07d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 16 Oct 2013 01:50:52 +0200 Subject: Delay TLS deallocation outside thread termination Since libc functions used up to actual thread termination (including the termination RPC itself) are to use TLS. * pthread/pt-alloc.c (initialize_pthread): Set `tcb` field of `new` to NULL. (__pthread_alloc): Deallocate TLS of to-be-reused `new` thread. * pthread/pt-create.c (__pthread_create_internal): Reset `tcb` field to NULL after deallocation. * pthread/pt-exit.c (__pthread_exit): Do not deallocate TLS. --- pthread/pt-exit.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'pthread/pt-exit.c') diff --git a/pthread/pt-exit.c b/pthread/pt-exit.c index c47b604..8468b80 100644 --- a/pthread/pt-exit.c +++ b/pthread/pt-exit.c @@ -69,11 +69,6 @@ __pthread_exit (void *status) if (self->cancel_state == PTHREAD_CANCEL_ENABLE && self->cancel_pending) status = PTHREAD_CANCELED; -#ifdef ENABLE_TLS - if (self->tcb) - _dl_deallocate_tls (self->tcb, 1); -#endif /* ENABLE_TLS */ - switch (self->state) { default: @@ -85,7 +80,7 @@ __pthread_exit (void *status) /* Make sure that nobody can reference this thread anymore, and mark it as terminated. Our thread ID will immediately become available for re-use. For obvious reasons, we cannot - deallocate our own stack. However, it will eventually be + deallocate our own stack and TLS. However, it will eventually be reused when this thread structure is recycled. */ __pthread_mutex_unlock (&self->state_lock); -- cgit v1.2.3