Skip to content

The threaded glium+winit example seems to be broken #1051

@pedrocr

Description

@pedrocr

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions