Skip to content

How does the event loop system work for this library? #3662

Answered by kchibisov
AeroSW asked this question in Q&A
Discussion options

You must be logged in to vote

The code is relatively simple so you can just try reading one backend, like e.g. wayland one, they are more traditional. But basically, the event loop is usually something like epoll (depends on the platform, I'd use epoll for simpliticy), this is what is behind the EventLoop` itself.

Once you run the loop, with one of the run APIs, you pass some state: &mut dyn ApplicationHandler (just a fat pointer to something implementing the trait), and then winit calls back to you once it gets event from the windowing system.

The ActiveEventLoop is the same as EventLoop under the hood, it's just a different type to make calls more safe to do, because on e.g. macOS you could be required to have event…

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@XCemaXX
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by AeroSW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants