-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 wasm32-wasip1-threads #133472
Conversation
The target has support for pthreads and allows registration of TLS destructors.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jhpratt (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
As suggested I have switched to using the UNIX thread_local implementation for WASI. For now I have added the missing |
Note that the new implementation shows the behavior described in #28129. However, this is consistent with the behavior of other UNIX platforms. I tested on FreeBSD and there TLS destructors are also not run for the main thread. |
I have created follow-up PR #133819 that deals with calling TLS destructors when the main thread exits on UNIX platforms other than Linux. |
r? @joboet You seem to have more knowledge of how this works, so feel free to take it over. I don't see anything wrong with the PR, though. |
Great, thanks!
I'm totally OK with temporarily adding these here. A PR on
Considering that this is documented as a caveat, I think this is fine for now, especially since this PR is already a big improvement over the status quo.
Cool, I'll have a look soon! @bors r+ |
Run TLS destructors for wasm32-wasip1-threads The target wasm32-wasip1-threads has support for pthreads and allows registration of TLS destructors. For spawned threads, this registers Rust TLS destructors by creating a pthreads key with an attached destructor function. For the main thread, this registers an `atexit` handler to run the TLS destructors.
Rollup of 6 pull requests Successful merges: - rust-lang#127565 (Teach rustc about the Xtensa VaListImpl) - rust-lang#128004 (codegen `#[naked]` functions using global asm) - rust-lang#133256 (CI: use free runners for i686-gnu jobs) - rust-lang#133472 (Run TLS destructors for wasm32-wasip1-threads) - rust-lang#133632 (CI: split x86_64-msvc job) - rust-lang#133827 (CI: rfl: move job forward to Linux v6.13-rc1) r? `@ghost` `@rustbot` modify labels: rollup
I believe this failed in rollup:
Included the @bors r- |
This was caused by not distinguishing between Should be fixed now. |
@rustbot review |
@bors r+ |
Run TLS destructors for wasm32-wasip1-threads The target wasm32-wasip1-threads has support for pthreads and allows registration of TLS destructors. For spawned threads, this registers Rust TLS destructors by creating a pthreads key with an attached destructor function. For the main thread, this registers an `atexit` handler to run the TLS destructors. try-job: test-various
Run TLS destructors for wasm32-wasip1-threads The target wasm32-wasip1-threads has support for pthreads and allows registration of TLS destructors. For spawned threads, this registers Rust TLS destructors by creating a pthreads key with an attached destructor function. For the main thread, this registers an `atexit` handler to run the TLS destructors. try-job: test-various
Rollup of 10 pull requests Successful merges: - rust-lang#131558 (Lint on combining `#[no_mangle]` and `#[export_name]`) - rust-lang#133122 (Add unpolished, experimental support for AFIDT (async fn in dyn trait)) - rust-lang#133184 (wasi/fs: Improve stopping condition for <ReadDir as Iterator>::next) - rust-lang#133456 (Add licenses + Run `cargo update`) - rust-lang#133472 (Run TLS destructors for wasm32-wasip1-threads) - rust-lang#133853 (use vendor sources by default on dist tarballs) - rust-lang#133946 (coverage: Prefer to visit nodes whose predecessors have been visited) - rust-lang#134010 (fix ICE on type error in promoted) - rust-lang#134029 (coverage: Use a query to find counters/expressions that must be zero) - rust-lang#134071 (Configure renovatebot) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#131558 (Lint on combining `#[no_mangle]` and `#[export_name]`) - rust-lang#133184 (wasi/fs: Improve stopping condition for <ReadDir as Iterator>::next) - rust-lang#133456 (Add licenses + Run `cargo update`) - rust-lang#133472 (Run TLS destructors for wasm32-wasip1-threads) - rust-lang#133853 (use vendor sources by default on dist tarballs) - rust-lang#133946 (coverage: Prefer to visit nodes whose predecessors have been visited) - rust-lang#134010 (fix ICE on type error in promoted) - rust-lang#134029 (coverage: Use a query to find counters/expressions that must be zero) - rust-lang#134071 (Configure renovatebot) - rust-lang#134102 (Miscellaneous fixes for nix-dev-shell) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133472 - rust-wasi-web:master, r=joboet Run TLS destructors for wasm32-wasip1-threads The target wasm32-wasip1-threads has support for pthreads and allows registration of TLS destructors. For spawned threads, this registers Rust TLS destructors by creating a pthreads key with an attached destructor function. For the main thread, this registers an `atexit` handler to run the TLS destructors. try-job: test-various
The target wasm32-wasip1-threads has support for pthreads and allows registration of TLS destructors.
For spawned threads, this registers Rust TLS destructors by creating a pthreads key with an attached destructor function.
For the main thread, this registers an
atexit
handler to run the TLS destructors.try-job: test-various