Fix panic when the process is suspended

In main event loop mio poll should immediately continue and retry on EINTR
https://github.com/gergo-salyi/multibg-sway/issues/1
This commit is contained in:
Gergő Sályi 2023-04-26 20:52:19 +02:00
parent 17c33ad756
commit 80f7f88532

View file

@ -119,7 +119,14 @@ fn main()
event_queue.dispatch_pending(&mut state).unwrap();
let mut read_guard_option = Some(event_queue.prepare_read().unwrap());
poll.poll(&mut events, None).unwrap();
if let Err(poll_error) = poll.poll(&mut events, None) {
if poll_error.kind() == io::ErrorKind::Interrupted {
continue;
}
else {
panic!("Main event loop poll failed: {:?}", poll_error);
}
}
for event in events.iter() {
match event.token() {