Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% CPU usage after exiting Sway. #48

Open
pbogut opened this issue Jul 22, 2023 · 0 comments
Open

100% CPU usage after exiting Sway. #48

pbogut opened this issue Jul 22, 2023 · 0 comments

Comments

@pbogut
Copy link

pbogut commented Jul 22, 2023

Thank you for this library, it works really well for me with only one issue.

When I use it to listen for events and exit my sway the process that is listening for events gets 100% CPU usage and never ends until I kill it.

Minimal test example:

use swayipc::{Connection, EventType, Fallible};
use swayipc_types::Event;

fn main() -> Fallible<()> {
    let subs = [EventType::Window, EventType::Shutdown];

    let sway = Connection::new()?;

    for event in (sway.subscribe(subs)?).flatten() {
        match event {
            Event::Window(ev) => println!("{:?}", ev),
            Event::Shutdown(_) => {
                println!("shut down");
                break;
            }
            _ => (),
        }
    }

    Ok(())
}

After running this and exiting sway with:

swaymsg exit

Process does not end at all and uses 100% CPU instead. It doesn't look like Shutdown is triggered either. I tied to test it by running command in separate terminal, outside of sway, and there is no output nor any error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant