epoll中的文件描述符返回的顺序是什么?

编程入门 行业动态 更新时间:2024-10-28 06:31:26
本文介绍了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中的文件描述符返回的顺序是什么?

本文发布于:2023-10-08 14:04:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472851.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:顺序   文件   epoll

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!