-
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
Make MutexGuard Send? #99613
Comments
We still use pthreads as fallback for platforms where futex based Mutexes are not yet implemented: rust/library/std/src/sys/unix/locks/mod.rs Lines 24 to 29 in 22d25f2
|
AFAIK the plan is to keep using pthreads on macOS. This means |
I believe we could do this if we decided to implement usync-style locks based around thread parking. This has been discussed at one point but has various drawbacks, and I'm unsure if it's still on the table. In general I don't think we should do this. It's reasonable for the OS to want to know which thread holds a lock, in order to be able to implement various schemes in its scheduler. I think this probably has more utility than the utility of being able to send mutexguards to other threads, and so we'd probably be better off leaving the option open of using locks that allow this, by not codifying it in our API. Parking lot supports this behind the |
Closing this as it has drawbacks as mentioned above and wouldn't be accepted and there are alternatives available |
Since Rust 1.62 has a new Mutex implementation that doesn't use pthread anymore, can we now mark MutexGuard as
Send
?The text was updated successfully, but these errors were encountered: