I was wondering whether there is – at least under Linux – a system call that watches a set of file descriptors and first “serves” the first file descriptor that got ready for operation.
I have been working with select and I do not expect that select enforces a kind of FirstComeFirstServed policy on the descriptors that watches, because its implementation should be a slight variation on polling.
Maybe I am asking for an event-driven handler, but I do not know anything about epoll beyond its mere existence.
Thanks
All event demultiplexers (
select/poll/epoll) signal all the FDs which need attention at that moment (based on the watch sets you provided), there’s no difference, except thatepollcan also be used in an edge-triggered way.At any moment the result set can contain multiple FDs (without any additional ordering) as you’re running on a multitasking OS, so by the time your process gets scheduled multiple events could have happened. Note: running an RT (Real-Time) kernel with your process set to high or realtime priority might help…