summaryrefslogtreecommitdiff
path: root/htl/pt-exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'htl/pt-exit.c')
-rw-r--r--htl/pt-exit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/htl/pt-exit.c b/htl/pt-exit.c
index 9d331d0d81..db6d560b36 100644
--- a/htl/pt-exit.c
+++ b/htl/pt-exit.c
@@ -26,6 +26,7 @@
#include <atomic.h>
#include <shlib-compat.h>
+#include <libc-internal.h>
/* Terminate the current thread and make STATUS available to any
thread that might join it. */
@@ -49,6 +50,9 @@ __pthread_exit (void *status)
/* Call destructors for the thread_local TLS variables. */
call_function_static_weak (__call_tls_dtors);
+ /* Clean up any state libc stored in thread-local variables. */
+ __libc_thread_freeres ();
+
__pthread_setcancelstate (oldstate, &oldstate);
/* Decrease the number of threads. We use an atomic operation to