-
Notifications
You must be signed in to change notification settings - Fork 213
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
RwLockReadGuard and RwLockWriteGuard should only be Sync when RawRwLock is #259
Comments
I believe this is not a problem since the only thing you can do with a |
Oh right, the problem is the:
method which would allow you to get a reference to the underlying |
Ah good point, I forgot about that one. I will adjust the trait bounds. |
Currently
RwLockReadGuard
s are marked asSync
so long as the contained type is, without having the same bound on theRawRwLock
type:parking_lot/lock_api/src/rwlock.rs
Line 878 in ecfe20b
This means that even if an implementer marks their guard as
GuardNoSend
, it's actually possible to send guard objects across threads using references to them (references are marked asSend
so long as the underlying type isSync
).Much like
MappedMutexGuard
this should probably only beSync
when the raw lock is.An example of sending
parking_lot
's non sendable guard objects across threads:https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=625dd71fdcd34658f0c2d2752a86ca0e
(Issue found by @sslab-gatech's Rust group)
The text was updated successfully, but these errors were encountered: