I would like to adopt a hack like FreeBSD did here: https://lists.freebsd.org/pipermail/svn-src-head/2010-August/019849.html
This allows dynamically loaded shared libraries to install pthread_atexit handlers. Currently there is no way for the lib to deinstall the handler in time, and later fork()s would crash the app. The same behaviour (auto deinstall the handlers) has been implemented in Linux and Solaris as well. I don't like the solution, but now solving it differently sounds painfull as well. What do others think? Martin