epoll_wait 是否表示同时添加 EPOLLIN 和 EPOLLOUT 时触发了哪个事件?
假设我在添加要使用 epoll_wait
进行监控的描述符时指定了 EPOLLIN
和 EPOLLOUT
标志。从“epoll”联机帮助页中,尚不清楚作为数组一部分返回的每个 epoll_event
结构在其 events
字段中携带什么。引用:
事件成员将包含返回的事件位字段。
这是否意味着无法区分触发的事件是否表示“可以写入”而不是“可以读取”?基本上有一个事件掩码,从逻辑上讲,我期望返回的数组能够准确表示文件描述符上“发生”的事件?
Suppose I am specifying both EPOLLIN
and EPOLLOUT
flags when adding descriptors to monitor with epoll_wait
. From the 'epoll' manpages it is unclear what exactly each of the epoll_event
structures returned as part of the array carries in its events
field. Quoting:
the events member will contain the returned event bit field.
Does it mean that it is impossible to distinguish whether an event was triggered signifying 'can-write' as opposed to 'can-read'? Basically there is an event mask, and I would logically expect returned array to signify exactly what event(s) have 'happened' on a file descriptor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的期望是正确的。
events
成员将包含该文件描述符发生的事件。Your expectation is right. The
events
member will contain the event(s) that have occured for that file descriptor.