I\'m playing around with Linux system call and I found some aspect of epoll
, that is not clear to me. Say, I create a epoll
instance:
Perusing through the source file for epoll, one sees that the ready events are maintained in a linked list. Events are removed from the head of the list and added to the end of the list.
Based on that, the answer is that the descriptor order is based on the order in which they became ready.
This behavior is now documented in the notes for epoll_wait:
If more than
maxevents
file descriptors are ready whenepoll_wait()
is called, then successiveepoll_wait()
calls will round robin through the set of ready file descriptors. ...
The documentation is thanks to @mtk .