-
Notifications
You must be signed in to change notification settings - Fork 294
The threaded glium+winit example seems to be broken #1051
Description
I've been adapting the glium+winit threaded example to chimper and input/refresh handling seems to have some brokenness to it. First the needs_update logic seems wrong:
conrod/examples/all_winit_glium_threaded.rs
Line 101 in 347fb99
| if events.is_empty() || !needs_update { |
This should probably be if events.is_empty() && !needs_update to not block on events when we've decided a new update is needed. And then there seems to be a race condition between the conrod and main threads. Here's the sequence of events.
MAIN: Received an event and passed it on to conrod
CONROD: Processed the event and issued a new draw and an event loop wakeup()
MAIN: works on the event handling some more
MAIN: blocks on event loop because the wakeup didn't come while it was blocked
Replacing event_loop.run_forever() with event_loop.poll_events() in the main thread works fine. I've tried moving the event loop into it's own thread that all it does is process events while the blocking in the main thread happens only on the render channel but that has it's own set of issues (conrod::backend::winit::convert_event() blocks, seems slow).
Any ideas on how to make this more robust?