[cxx-abi-dev] thread_local destructors
Dennis Handly
dhandly at cup.hp.com
Thu Sep 20 22:26:32 UTC 2012
>From: Jason Merrill <jason at redhat.com>
>As discussed in N2659 it is possible to support
>dynamic initialization in just the compiler, but for destruction we need
>a thread-local version of atexit. This seems to call for a new runtime
>entry point __cxa_thread_atexit.
(Or spell it __cxa_atexit_thread.)
Also, do we need a __cxa_finalize_thread function?
And what happen when exit is called? All existing object destroyed in order?
Do we need a new data structure that will have:
address
dtor
__dso_handle
thread_id
next
And __cxa_finalize & __cxa_finalize_thread will know how to handle it?
(And too late to add an extra parm to __cxa_finalize.)
>The question is, do we want to try to deal with the intersection of
>threads and shared libraries?
We should at least provide the shared lib KEY (__dso_handle) to
__cxa_thread_atexit, in case we want to try to handle it.
>If the user dlcloses a library with TLS objects that have destructors in
>multiple threads, trying to arrange for the affected threads to run the
>relevant destructors seems complex. Are other people comfortable just
>saying "don't do that"?
Jason
Has anyone thought of a design?
Would one of the "don't do that" responses be to at least dump a list of
all of the TLS objects (addresses of object and dtor and the shlib KEY) that
are affected, before aborting?
More information about the cxx-abi-dev
mailing list