#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. */
/* 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
libc_hidden_proto (__libc_freeres)
/* Free resources stored in thread-local variables on thread exit. */
-extern void __libc_thread_freeres (void)
-#if PTHREAD_IN_LIBC
- attribute_hidden
-#endif
- ;
+extern void __libc_thread_freeres (void) attribute_hidden;
/* Define and initialize `__progname' et. al. */
extern void __init_misc (int, char **, char **) attribute_hidden;