On Fri, Aug 11, 2017 at 04:31:44PM +0200, Mark Kettenis wrote:
> The diff below implements __cxa_thread_atexit().  Calls to this
> function are emitted by the compiler to schedule running desctructors
> for thread_local objects when a thread terminates or calls exit(3).
> The Linux implementation prevents unloading of shared libraries that
> registered such destructors to prevent things from crashing.  This
> diff does not implement that functionality yet.  I plan to add that
> later.  I expect this to be a bit of a corner case.

Well, if you don't care that much about the corner case, you can
directly use the generic fallback implementation in libc++abi.
Preventing unloading is the least stupid of all options, the rest
basically break one major promise or another.

> I've chosen to implement __cxa_thread_atexit() directly instead of
> __cxa_thread_atexit_impl().  I think that is cleaner.  It means we
> don't need to make changes to libc++ for this to start working.  It
> looks like modern libstdc++ version will detect __cxa_thread_atexit().

Which version did you look at? All cases I have seen check exclusively
for *_impl(). That's why I settled down on making it the official
interface in NetBSD and providing the more natural __cxa_thread_atexit
only as weak alias.

Joerg

Reply via email to