https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113401
--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> --- for platforms using pthreads as the underlying resource, then perhaps we can do this without thread_atexit (which I do not see in many places) by using pthread_cleanup_push () not sure if gthr.h abstracts that in any way (I do not have a patch at the moment).