Skip to content

Commit

Permalink
linux: Retry epoll::wait on EINTR
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmehall committed Jan 31, 2024
1 parent fc693a9 commit 61b7eda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platform/linux_usbfs/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use once_cell::sync::OnceCell;
use rustix::{
event::epoll::{self, EventData},
fd::OwnedFd,
io::retry_on_intr,
};
use slab::Slab;
use std::{
Expand Down Expand Up @@ -52,7 +53,7 @@ fn event_loop() {
let epoll_fd = EPOLL_FD.get().unwrap();
let mut event_list = epoll::EventVec::with_capacity(4);
loop {
epoll::wait(epoll_fd, &mut event_list, -1).unwrap();
retry_on_intr(|| epoll::wait(epoll_fd, &mut event_list, -1)).unwrap();
for event in &event_list {
let key = event.data.u64() as usize;
let device = DEVICES.lock().unwrap().get(key).and_then(|w| w.upgrade());
Expand Down

0 comments on commit 61b7eda

Please sign in to comment.