rust-windowing / rust-windowing/winit
Make `Window` `!Send + !Sync`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Part of https://github.com/rust-windowing/winit/issues/3367, opening to discuss separately.
We've worked hard on trying to make Window safely Send + Sync, but this somewhat obscures what's really happening underneath the hood: Some backends use Mutex, others like macOS/iOS dispatch the events to the main thread (and you may even deadlock if you try to use the window from a thread while the event loop is not running).
So maybe this is actually the wrong solution, and windows should not actually be Send + Sync? Though if we remove it, we'll still have to find some way of allowing users to render on different threads.
Are there other use-cases for Send + Sync windows (other than rendering)?
Related: https://github.com/rust-windowing/winit/issues/3317, https://github.com/rust-windowing/winit/issues/3434.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the discussions in issues #3367, #3317, and #3434, then examine how the current Window threading guarantees interact with backend event dispatch. Done would be a resolved design direction for the Send/Sync decision and a clear account of how rendering on other threads should work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100