What is the order in which File Descriptors in epoll are returned?

后端 未结 2 923
花落未央
花落未央 2021-01-18 10:47

Let\'s say I have set a set of file descriptors, say 8, 9, 10, 11, 12 in the order specified and do an epoll_wait() for data to be read on them.

epoll_wait returns w

相关标签:
2条回答
  • 2021-01-18 11:17

    The man page does not say anything specifically about the order, so it probably would not be a good idea to depend on the order when you call it. Even if they were returned in order in one implementation, they might not be in another. It would be best to assume that they could be returned in any order.

    0 讨论(0)
  • 2021-01-18 11:38

    Just think about it logically. Presumably they're not all marked as readable as a single atomic operation, and epoll_wait might then just as well just return 1 fd available each time it's called. It makes no sense to depend on the order of it's output.

    0 讨论(0)
提交回复
热议问题