summaryrefslogtreecommitdiff
path: root/htl/pt-exit.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2025-11-22 02:25:26 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-11-22 03:27:40 +0100
commit604bdb0f8e9c0873b5420ec4429bd1dc40a41860 (patch)
tree5679f56811159583098c15a3763f895fd1a9883a /htl/pt-exit.c
parentaa6066087f5a4d709ff148591d4a58564e2b09bf (diff)
htl: Also use __libc_thread_freeres to clean TLS state
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