mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-28 03:43:23 +00:00
Return Ok when timer expired in do_poll
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
4dacff5be4
commit
faa4234c7d
@ -100,7 +100,15 @@ pub fn do_poll(poll_fds: &[PollFd], timeout: Option<Duration>) -> Result<usize>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(timeout) = timeout.as_ref() {
|
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 {
|
} else {
|
||||||
poller.wait()?;
|
poller.wait()?;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user