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

EventLoopProxy is !Sync on macOS #3220

Closed
WilliamVenner opened this issue Nov 11, 2023 · 1 comment
Closed

EventLoopProxy is !Sync on macOS #3220

WilliamVenner opened this issue Nov 11, 2023 · 1 comment

Comments

@WilliamVenner
Copy link

I'm pretty sure CFRunLoopSourceSignal, CFRunLoopGetMain and CFRunLoopWakeUp are thread-safe on macOS.

std::sync::mpsc::Sender became Sync in Rust 1.72.0.

If we want to support older Rust versions, would it not be worth swapping std mpsc for crossbeam-channel in order to support sending user events from other threads?

If not a bug, then this is also a bit of an undocumented footgun. I didn't really expect EventLoopProxy to be !Sync, isn't the whole idea for sending events from other threads? Sure, I guess users can just wrap it in a Mutex, but that's introducing somewhat needlessly complicated platform-specific code downstream, and I don't think that's the intention.

@WilliamVenner
Copy link
Author

Nevermind, I think this is intentional, and Rust 1.72.0 caused platform differences in winit that lead to EventLoopProxy becoming auto Sync on some platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant