-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
MutexGuard and others should be Send #23465
Comments
These are actually intentionally not sendable. To quote the standard:
As a result these structures are not sendable as we must guarantee that the lock is only released on the same thread that acquired it. |
Since Rust 1.62 has a new Mutex implementation without pthread, should this be reconsidered? |
Unix-like OS without futexes still use pthread locks, and for windows
I also looked around and didn't find any actually stated guarantee that futexes can be released by a non-owning thread. |
@masklinn a futex is just an AtomicU32. As long as the thread has access to the shared memory it can "own" it. |
MutexGuard
,RwLockWriteGuard
andRwLockReadGuard
are currently!Send
. They should beSend
.This also currently causes
StdinLock
andStdoutLock
to be!Send
.The text was updated successfully, but these errors were encountered: