[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] exceptfds



On Wed, Apr 11, 2012 at 6:18 AM, Florian Lohoff <f@xxxxx> wrote:
>
> Hi,
>
> is there a reason libevent has no way to feed in exceptfds?

I'm not sure why; Niels had it working that way before I came one to
the project.

One issue here is that exceptfds (as supported by select) don't always
match up exactly with "equivalents" under other backends.  For
example, ISTR that they aren't always the same thing as
POLLPRI/EPOLLPRI on all platforms, and I am not sure they even have an
equivalent under kqueue (do they?).  With Windows's select, you need
to use exceptfds to detect completed connect()s.

Before Libevent 2.0, there wasn't a good way to have a feature that
only some backends could support, or that different backends would
support in incompatible ways.  Now, you could do by requiring features
in an event_config, but nobody's specified or implemented an
"exceptfds" feature with that yet.

> I have a little project for a couple of years with DVB Streaming and certain
> ioctls for linux DVB drivers require the fds to be polled for exceptions. Up to
> now all drivers were happy to also trigger read events but now there are some
> beeing correct on the specs to i need to poll on exceptions on an fd.
>
> libevent does not seem to support this but is there a way around?
>
> Currently the plan is to split this into a seperate thread with its
> own select loop.

That would probably work; poll would likely be a better choice.

If you're looking for a quick&ugly hack, and you're willing to use a
patched-up libevent, you could go through poll.c or epoll.c and
replace POLLIN with POLLIN|POLLPRI, assuming that you're willing to
tread "read" and "priority read" as one event, and assuming that the
DVB event you need to know about gets treated as POLLPRI as well as
exceptfd.

For a more general hack, somebody could try to figure out the
portability issues and the right API, and come up with a general
implementation of this for Libevent.

yrs,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.