[PATCH 02/12] event-loop: Add support for BSD???s kevent() instead of epoll()

Philip Withnall philip at tecnocode.co.uk
Sat Feb 16 04:26:57 PST 2013


On Fri, 2013-02-15 at 09:33 -0600, Jason Ekstrand wrote:
> Would it be a better overall solution if we simply replace timerfd and
> signalfd with a more generic architecture and then move the guts of
> the event loop to poll or select?  Another idea that was brought up on
> IRC this last weekend was to use an external library such as libevent
> where they've already done all of the event abstraction for us.
> However, that involves pulling in another dependency which may not be
> worth it.

I hadn't realised there are going to be other event loop backends. I
probably should've thought more about it. I guess in that case, I'd
suggest going for libevent, rather than re-inventing the wheel (and
ending up with a #ifdef mess).

From my own experience doing this FreeBSD work, event loops aren't
trivial to get right, and can have subtle bugs which only turn up
occasionally. Using libevent would avoid that pain.

However, if we don't want to go with libevent, then the #ifdef mess
could be ameliorated a bit by splitting event-loop.c up into
per-event-mechanism files; e.g. event-loop-epoll.c, event-loop-kqueue.c,
etc. I guess then event-loop-epoll.c would contain the code for glibc
and Bionic, with some #ifdefs around timerfd and signalfd usage.

Philip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130216/afbe87ce/attachment.pgp>


More information about the wayland-devel mailing list