Edge-triggered interfaces are too difficult?
Posted Mar 14, 2003 8:59 UTC (Fri) by
dank (guest, #1865)
In reply to:
Edge-triggered interfaces are too difficult? by dneto
Parent article:
Edge-triggered interfaces are too difficult?
I've been programming with edge-triggered
interfaces for some time now (sigio, epoll)
and I love 'em. The paradigm is
for (;;) {
get next event on any monitored fd
handle that event
}
where handling an event means e.g. reading from the
associated fd until there's no more to read,
using nonblocking mode.
Piece o' cake. The big plus for me (besides the
blazing speed) is that I *never have to reset
my interest mask*. I've written a lot of nonblocking
I/O engines, and I never got good at computing the
interest mask. So not having to do it anymore
is a big relief.
The only big surprise for new
users is that they *really do have to read
until there's no more to read*, otherwise
the next event will never come.
It's these new users, and people porting stuff
from Solaris, who will most appreciate the
level-triggered approach, which is more forgiving
(it doesn't care how much you read, etc).
See http://www.kegel.com/c10k.html for my
notes on the subject.
(
Log in to post comments)