Calling __cxa_thread_atexit_impl directly, from C code

Florian Weimer fweimer@redhat.com
Fri Aug 26 08:31:35 GMT 2022


Do we support calling __cxa_thread_atexit_impl directly?  The function
is not documented, nor is it declared in any installed header.

I think the answer is yes, because we support different C++
implementations, and they have to call __cxa_thread_atexit_impl for
thread-local destructors, either directly or through a wrapper
(__cxa_thread_atexit for libstdc++, as proposed for the Itanium C++
ABI).

There's interest in this because it's much easier to use than
pthread_key_create if you have to avoid linking against libpthread and
you target glibc releases between 2.18 and 2.33 (although it is possible
to use weak symbols, as in the libstdc++ implementation in
libstdc++-v3/libsupc++/atexit_thread.cc).

Thanks,
Florian



More information about the Libc-alpha mailing list