See the conrod issue for a discussion on this:
PistonDevelopers/conrod#1051
To get a non-polling multi-threaded app running the conrod examples do the following:
- Create a rendering thread that reads inputs and writes it's output to a set of
std::sync::mpsc channels
- Block the main loop on
EventsLoop::run_forever()
- In the rendering thread whenever we have written the output use an
EventsLoopProxy::wakeup() to wake up the main thread
- Inside
run_forever() pass on events to the channel until we get an Awakened
- Finish the main loop by rendering from the second channel and go back to blocking in
run_forever()
The problem with this setup is that step 3 doesn't reliably unblock run_forever() because if you use EventsLoopProxy::wakeup() when not inside run_forever() the next time run_forever() runs it will not immediately unblock.
Is this intended behavior? @mitchmindtree was expecting the semantics of wakeup() to be that if it's called it will unblock run_forever() immediately when it gets called and that does sound much more useful.
See the conrod issue for a discussion on this:
PistonDevelopers/conrod#1051
To get a non-polling multi-threaded app running the conrod examples do the following:
std::sync::mpscchannelsEventsLoop::run_forever()EventsLoopProxy::wakeup()to wake up the main threadrun_forever()pass on events to the channel until we get anAwakenedrun_forever()The problem with this setup is that step 3 doesn't reliably unblock
run_forever()because if you useEventsLoopProxy::wakeup()when not insiderun_forever()the next timerun_forever()runs it will not immediately unblock.Is this intended behavior? @mitchmindtree was expecting the semantics of
wakeup()to be that if it's called it will unblockrun_forever()immediately when it gets called and that does sound much more useful.