Unify TLS destructor list implementations#116850
Closed
joboet wants to merge 4 commits intorust-lang:masterfrom
Closed
Unify TLS destructor list implementations#116850joboet wants to merge 4 commits intorust-lang:masterfrom
joboet wants to merge 4 commits intorust-lang:masterfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #110897.
Currently, nearly every platform implements its own TLS destructor list. This adds unnecessary code and means that issues like #116390 are harder to find and fix. Therefore, this PR unifies all of these implementations into a shared one inside
sys::common::fast_local, leaving behind only the platform calls needed to ensure the list is emptied.This changes behaviour on some Linux-like platforms, because we now keep our own list. This should however not impact performance too much, as the platform calls would also have needed to allocate.
Because it is only used on UNIX and is now much easier, I've removed the fallback implementation in
sys_common. BecauseStaticKeymay now be unused, this resulted in errors for Windows, which is why I have refactored that code to move the at-exit hack to the newthread_local_guardmodule. If it causes too much review pain, I can split this part out.Tested on aarch64 macOS, checked on all other platforms. Best reviewed per-commit.
@rustbot label +T-libs +A-thread-locals