poll vs. epoll

Dan Kegel dank at kegel.com
Fri Aug 20 09:12:35 CDT 2004

Shachar Shemesh wrote:
>> 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
> Sure will have a look.

>> 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.
> I'm sure that edge trigger yields better performance. The problem, 
> however, what with all the potential races edge trigger introduces, and 
> the fact I'm not sufficiently familiar with the wineserver semantics, 
> that going edge trigger in a bug free way right now is beyond me.

"potential race conditions" is the wrong way to think about
it, really.
Switching to edge triggered epoll from select() or poll() is
always an interesting intellectual challenge; you're
fundamentally switching to an idiom where the app has
to remember more than it did before.
Once you've done it a few times, it gets easier.

If I have time, I'll have a look at the state machine
inside wineserver and see how tricky it'd be.
- 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