epoll中的文件描述符返回的顺序是什么? [英] What is the order in which File Descriptors in epoll are returned?

查看:80
本文介绍了epoll中的文件描述符返回的顺序是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我已经按照指定的顺序设置了一组文件描述符,例如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中的文件描述符返回的顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆