poll vs. epoll

Dan Kegel dank at kegel.com
Thu Aug 19 19:59:21 CDT 2004

Shachar wrote:
> I noticed that in server/fd.c, the wineserver is using "poll" to select 
> between file descriptors. The application is going through this code 
> over 2000 times a second, with over 380 file descriptors each time. I am 
> wondering whether this can be the cause of the slowdown.
> One of the possible solutions to this would be to use epoll instead. 
> This, of course, would have to be backed by a configure check, as not 
> all systems for which wine is intended support epoll. Another, arguably 
> better, solution would be to use libevent for this purpose. Libevent has 
> the distinct advantage that it automatically chooses the best tool for 
> the job (epoll, poll, /dev/poll, or if all else fails, select).

By all means, let's try epoll.
FWIW, I wrote a wrapper layer that illustrates how to detect
whether epoll etc. are available.  I'm convinced that *runtime*
detection is the only way to go.  Compile time detection is insufficient.
My code is at http://kegel.com/rn
If you actually try to use it, let me know.  I expect it might
be useful mostly as a guide.  It's edge-trigger oriented, but
you can trivially add the flag (or remove the flag) needed to
get level-triggered behavior again if you really need it.
I highly recommend using edge-triggered behavior, though.
- Dan

My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change

More information about the wine-devel mailing list