fix(event loop): error in poll when other threads paused due to EINTR

This commit is contained in:
Nova
2022-07-13 11:17:47 -04:00
parent d7638e3c2d
commit 0e3313b056

View File

@@ -52,7 +52,14 @@ impl EventLoop {
poll.registry()
.register(&mut stop_receiver, STOP, Interest::READABLE)?;
'event_loop: loop {
poll.poll(&mut events, timeout)?;
match poll.poll(&mut events, timeout) {
Err(e) => {
if e.kind() == std::io::ErrorKind::Interrupted {
continue 'event_loop;
}
}
_ => {}
}
for event in &events {
match event.token() {
LISTENER => EventLoop::accept_client(&socket, &mut clients, &poll)?,