[Libguestfs] [libnbd PATCH] rust: Use mio::poll instead of requiring epoll
Eric Blake
eblake at redhat.com
Tue Sep 5 14:45:44 UTC 2023
On Mon, Sep 04, 2023 at 06:59:15PM +0000, Tage Johansson wrote:
>
> > > + // can be both readable and writable, but we survive just fine
> > > + // if we only see one direction even when both are available.
> > > + poll.registry().register(
> > > + &mut SourceFd(&fd),
> > > + Token(0),
> > > + MioInterest::READABLE | MioInterest::WRITABLE,
> > > + )?;
> > > + poll.poll(&mut events, Some(Duration::ZERO))?;
> > Why do we want 'poll.poll()?;', that is, to fail this function if the
> > poll returns an error? We _expect_ poll to sometimes return an error
> > (namely, the fact that it timed out) if there is nothing pending on
> > the fd, at which point we WANT to successfully clear the ready_guard
> > for both read and write, rather than to error out of this function.
>
>
> You are right. I thought that the poll() call would return Ok(()) upon
> timeout, but according to the documentation:
>
> > Currently if the timeout elapses without any readiness events triggering
> > this will return Ok(()). However we’re not guaranteeing this behaviour
> > as this depends on the OS.
>
> So I guess it is best to ignore any errors from the poll call as in your
> patch.
Okay, I'll merge in that aspect of my original along with your other
improvements, and push something soon. Fingers crossed that we'll
finally get a green CI run today.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
More information about the Libguestfs
mailing list