Scoped thread implicit join completes before thread-locals are dropped #116179
Labels
A-thread
Area: `std::thread`
A-thread-locals
Area: Thread local storage (TLS)
C-bug
Category: This is a bug.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
When a scoped thread is implicitly joined, the destructors of thread-local variables are not guaranteed to have completed when the scope is exited. When a scoped thread is explicitly joined, however, the destructors of thread-local variables do complete before the scope is exited.
I tried this code:
I expected to see this happen: explanation
Instead, this happened: explanation
Meta
The same behaviour is observed on the nightly version
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.74.0-nightly (0288f2e19 2023-09-25)
.rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: