Return Ok when timer expired in do_poll

This commit is contained in:
Yuke Peng
2024-07-22 15:41:10 +08:00
committed by Tate, Hongliang Tian
parent 4dacff5be4
commit faa4234c7d

View File

@ -100,7 +100,15 @@ pub fn do_poll(poll_fds: &[PollFd], timeout: Option<Duration>) -> Result<usize>
}
if let Some(timeout) = timeout.as_ref() {
poller.wait_timeout(timeout)?;
match poller.wait_timeout(timeout) {
Ok(_) => {}
Err(e) if e.error() == Errno::ETIME => {
// The return value is zero if the timeout expires
// before any file descriptors became ready
return Ok(0);
}
Err(e) => return Err(e),
};
} else {
poller.wait()?;
}