macOS: panic when using std::thread::current
in thread_local
Drop
implementatiopn
#116933
Labels
A-thread
Area: `std::thread`
A-thread-locals
Area: Thread local storage (TLS)
C-bug
Category: This is a bug.
O-macos
Operating system: macOS
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
I tried this code:
The output of this is:
Meta
rustc --version --verbose
:The same bug is present on nightly:
Backtrace
Operating system
This seems to only affect macOS. I've tested it on macOS Venture 13.4.1.
On Linux everything works as expected.
Why is this important?
I discovered this problem because I am using
crossbeam::channel
in aDrop
implementation to communicate to another thread, and crossbeam callsstd::thread::current
.It seems very reasonable to me that
std::thread::current
should always work. In particular, it is very useful to be able to have a thread-local object deregister itself on destroy by e.g. removing its thread-id from a global set of active threads, or sending it over a channel to a parent thread.Workarounds
None that I have found (yet)
The text was updated successfully, but these errors were encountered: