Skip to content
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 EventLoopProxy Sync #3449

Merged
merged 2 commits into from
Feb 19, 2024
Merged

Make EventLoopProxy Sync #3449

merged 2 commits into from
Feb 19, 2024

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Feb 1, 2024

Fixes #3448.

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@madsmtm madsmtm added S - enhancement Wouldn't this be the coolest? DS - macos S - api Design and usability DS - ios labels Feb 1, 2024
@madsmtm madsmtm changed the title Make EventLoopProxy Sync Make EventLoopProxy Sync Feb 1, 2024
@kchibisov
Copy link
Member

Maybe we should push the Waker PR forward instead, since it should be Send + Sync?

Copy link
Member

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@daxpedda
Copy link
Member

daxpedda commented Feb 3, 2024

Maybe we should push the Waker PR forward instead, since it should be Send + Sync?

I don't think it hurts to merge this in the meantime.

Comment on lines 6 to 10
#[allow(dead_code)]
fn is_send<T: 'static + Send>() {
// ensures that `winit::EventLoopProxy` implements `Send`
needs_sync::<winit::event_loop::EventLoopProxy<T>>();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just use needs_sync, because we test Send in other test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't test if EventLoopProxy implements Send, it tests if EventLoopProxy implement Sync if T is Send.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you can move the T: Send in the test itself?

Copy link
Member

@daxpedda daxpedda Feb 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can use generics on #[test]. It would be a compile error anyway so we don't actually need #[test] in the first place.

I think the way it's right now is just fine, but maybe adding a comment would help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what I should write as a comment, but I've made the exiting comment text a bit clearer

src/event_loop.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: daxpedda <daxpedda@gmail.com>
Closes: #3448
@kchibisov kchibisov merged commit 542d193 into master Feb 19, 2024
51 checks passed
@kchibisov kchibisov deleted the event-loop-proxy-sync branch February 19, 2024 04:47
@madsmtm madsmtm mentioned this pull request Feb 27, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DS - ios DS - macos DS - web S - api Design and usability S - enhancement Wouldn't this be the coolest?
Development

Successfully merging this pull request may close these issues.

It is a foot-gun that EventLoopProxy is !Sync on macOS
4 participants