tao icon indicating copy to clipboard operation
tao copied to clipboard

`EventLoop` doesn't wake up reliably when setting `control_flow` to `ControlFlow::WaitUntil`

Open dfaust opened this issue 1 year ago • 0 comments

Describe the bug When setting the control_flow argument of the closure passed to the EventLoop::run function to ControlFlow::WaitUntil, the event loop wakes up a couple of times and then stops until an event arrives.

Steps To Reproduce

use tao::event_loop::{ControlFlow, EventLoopBuilder};

fn main() {
    let event_loop = EventLoopBuilder::new().build();

    event_loop.run(move |event, _, control_flow| {
        *control_flow = ControlFlow::WaitUntil(
            std::time::Instant::now() + std::time::Duration::from_millis(16),
        );

        println!("poll");
    })
}

Expected behavior The event loop should wake up after 16ms if no event arrives.

Platform and Versions (please complete the following information): OS: Linux Rustc: 1.83.0-nightly (9e394f551 2024-09-25)

Additional context Happens with the current tao release and dev branch (commit c49b83a).

dfaust avatar Oct 17 '24 20:10 dfaust