Skip to content

Commit

Permalink
Merge pull request #1085 from stlankes/mio
Browse files Browse the repository at this point in the history
improve compatibility to the BSD socket layer
  • Loading branch information
stlankes authored Feb 29, 2024
2 parents 1d7d019 + d0e44de commit 734dabb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,17 @@ async fn poll_fds(fds: &mut [PollFd]) -> Result<u64, IoError> {
/// monitored is specified in the `fds` argument, which is an array
/// of structs of `PollFd`.
pub fn poll(fds: &mut [PollFd], timeout: Option<Duration>) -> Result<u64, IoError> {
block_on(poll_fds(fds), timeout)
let result = block_on(poll_fds(fds), timeout);
if let Err(ref e) = result {
if timeout.is_some() {
// A return value of zero indicates that the system call timed out
if *e == IoError::EAGAIN {
return Ok(0);
}
}
}

result
}

/// `eventfd` creates an linux-like "eventfd object" that can be used
Expand Down

0 comments on commit 734dabb

Please sign in to comment.