-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Windows thread-local keyless drop #90442
Conversation
`#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function).
// The short version is that all the function pointers in the `.CRT$XL*` array | ||
// will be called whenever a thread or process starts or ends. | ||
|
||
#[link_section = ".CRT$XLD"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems pretty reasonable to me! Could the previously-registered "at thread exit" function get a new hook to call into this module though? I think it 'd probably be best to avoid these #[link_section]
annotations if we can and have them consolidated into one place if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've used a normal Rust function for running the new dtors and simply made the exit function call it. Is this what you had in mind?
This comment has been minimized.
This comment has been minimized.
8178cb3
to
1048651
Compare
@bors: r+ Looks great to me! |
📌 Commit 1048651 has been approved by |
…chton Windows thread-local keyless drop `#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function). r? `@alexcrichton`
…chton Windows thread-local keyless drop `#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function). r? ``@alexcrichton``
…chton Windows thread-local keyless drop `#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function). r? ```@alexcrichton```
☀️ Test successful - checks-actions |
Finished benchmarking commit (c3190c1): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
#[thread_local]
allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function).r? @alexcrichton