Edge-triggered interfaces are too difficult?
Posted Mar 15, 2003 6:17 UTC (Sat) by
IkeTo (subscriber, #2122)
In reply to:
Edge-triggered interfaces are too difficult? by dank
Parent article:
Edge-triggered interfaces are too difficult?
> for (;;) {
> get next event on any monitored fd
> handle that event
> }
Is that exactly the same code the parent says might ends up in race condition? In particular, what should happen if an event arrives exactly at the time *after* you handle all events and before you start another monitoring? It seems like that to resolve this race, the kernel may keep a "marker" to know whether an unreported event has occurred. Then we have another problem that the user may get the event during the "handle that event" phase. And the kernel need to check that the "marker" is real before returning to the user. While solvable, it seems not much less work compared to level triggered interface.
On the other hand, is the user-land side really "a piece of cake" compared to level triggered semantics? You need exactly the same code, except that in the "handle that event" part the program can read any event as oppose to read all events?
(
Log in to post comments)