-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run TLS destructors for main thread on UNIX platforms #133819
Conversation
This calls TLS destructors on UNIX platforms other than Linux when the main thread exits. This is done by registering a process-wide atexit handler.
This comment has been minimized.
This comment has been minimized.
Hi, T-libs! Are you okay with this behaviour change? This makes platforms like musl behave the same way as glibc; they will now run TLS destructors both when @rustbot label +I-libs-nominated |
This is currently documented as platform-specific behavior here. The main benefit of this PR would be to make the behavior more consistent across platforms so that we can remove the warning in the documentation and make it a guarantee. However for that to happen we need to be able to ensure that this works on all platforms. Could you have a look at other (non-UNIX) platforms to see what the current behavior is and whether they need a similar workaround? |
I can have a look, however I certainly don't have access to all platforms supported by Rust. I can test on Windows, Linux, FreeBSD and WASI preview 1. Is there a way to run test programs on all Tier 1 and Tier 2 targets via CI, so that I could run automatic tests? |
So this what I was able to gather by looking at the code and doing some testing where possible.
SummaryTargets that do not have support for threads (i.e. The remaining non-UNIX targets should either work (Hermit, Solid) or do not have the concept of process exit ( |
That's a great summary, thank you! One other thing to note though is that not every UNIX platform has native thread local storage, and that the solution proposed in this PR will not work for them since |
Could you name such a platform so that I can test? Preferably something that can be run in a VM. |
Oh wow, they've become quite rare since last time I checked. But Solaris (e.g. |
Closing in favor of #134085 |
This calls TLS destructors on UNIX platforms other than Linux when the main thread exits. This is done by registering a process-wide atexit handler.
r? joboet