-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Remove Sync bound from Command #5871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It compiles! This lines up with my mental model of commands: they're dispatched across threads to various systems and collected back from them (and so need a Send
bound), but there's no time where a Sync
bound would be required.
@DJMcNab if you're in agreement I'm happy to merge this right away.
I'd need to do an audit of CommandQueue to be sure. iirc it unsafely implements Send and Sync, referencing this impl? I think SystemParam's state need to be Send/Sync, so this compiling seems suspect to me without any actual checks. For example, this compiling without the Send bound would definitely be wrong, but I somewhat suspect it might do. We probably should have a safety comment here that that supertrait is required for soundness. Also, I thought there was already another pr which did this, although I don't have a reference to hand. It might have started, but the plumbing required to actually do it correctly overwhelmed the author - not sure? Always happy to tidy up our send/sync requirements, but I need to check this is actually correct. |
A quick skim of the PRs didn't show anything for me, and I don't remember this. It appears that the SAFETY comments of Definitely needs a close look though. |
I did look into this beforehand and didn't just remove Sync. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this aligns with my view of the world
bors r+ |
Unless I'm mistaken it is unnecessary, Commands are never accessed from two threads simultaneously. It unnecessarily restricts Command structs
Pull request successfully merged into main. Build succeeded: |
Unless I'm mistaken it is unnecessary, Commands are never accessed from two threads simultaneously. It unnecessarily restricts Command structs
Unless I'm mistaken it is unnecessary, Commands are never accessed from two threads simultaneously. It unnecessarily restricts Command structs
Unless I'm mistaken it is unnecessary, Commands are never accessed from two threads simultaneously. It unnecessarily restricts Command structs
Unless I'm mistaken it is unnecessary, Commands are never accessed from two threads simultaneously. It unnecessarily restricts Command structs