[libcxx-commits] [PATCH] D155278: [libc++][mingw] TLS cleanup on windows
Karl-Johan Johnsson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 10 05:01:33 PDT 2023
kalle-llvm added a comment.
Unfortunately I have not been able to come up with a race-free way to clean up the tls key and still allow exception handling to keep working for code that runs after the cleanup (like destructors of global variables which can run concurrently).
However, in cxa_exception_storage.cpp there is another implementation of __cxa_get_globals() that is ifdef-ed by `HAS_THREAD_LOCAL`. This doesn't seem to be documented anywhere, but searching for it I found this <https://github.com/android/ndk/issues/1200> which is the exact same bug. And turning on `HAS_THREAD_LOCAL` fixes it for me too.
@mstorsjo So `thread_local` seems to work on mingw, are there any gotchas? If not, perhaps `HAS_THREAD_LOCAL` should be turned on (at least on mingw, but it seems to me this bug should be possible to trigger on other platforms).
(This still leaves the issue with `__thread_specific_pointer`, but at least that can be worked around by not using `std::thread`.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155278/new/
https://reviews.llvm.org/D155278
More information about the libcxx-commits
mailing list