假设我已经按照指定的顺序设置了一组文件描述符,例如8、9、10、11、12,并执行了epoll_wait()以便在其上读取数据.
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返回的数据将在套接字8,10和11上读取.epoll数组中返回的文件描述符的顺序是8、10和11,还是会混杂?
epoll_wait returns with data to be read on socket 8,10 and 11. Will the order of the file descriptors returned in the epoll array be 8, 10 and 11 or could they be jumbled?
推荐答案手册页并未具体说明订单,因此在调用订单时依赖订单可能不是一个好主意.即使在一个实现中按顺序返回它们,也可能不在另一个实现中.最好假设它们可以以任何顺序退货.
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.
更多推荐
epoll中的文件描述符返回的顺序是什么?
发布评论