简体   繁体   English

边缘触发的epoll c

[英]Edge Triggered epoll c

On an edge triggered epoll event I read a socket (or multiple sockets, if required) until there is no more data ( EAGAIN or EWOULDBLOCK ) then loop back to epoll_wait . 在边缘触发的epoll事件中,我读取了一个套接字(或多个套接字,如果需要),直到没有更多数据( EAGAINEWOULDBLOCK )然后循环回epoll_wait What happens if, while processing that read, another socket (one that is not currently being read) becomes ready to read? 如果在处理读取时,另一个套接字(当前未读取的套接字)已准备好读取,会发生什么? Would the edge triggered epoll ignore this as it wasn't blocking in an epoll_wait at the time of the trigger/signal or would it return with the socket in the events array immediately on the next call to epoll_wait ? 边缘触发epoll是否会忽略这一点,因为它在触发/信号时没有在epoll_wait中阻塞,或者它会在下一次调用epoll_wait立即返回事件数组中的套接字?

This will indeed work, epoll acts as if all events which happened to the epoll group before you made the epoll_wait call happened the moment you make the call. 这确实有效,epoll就像你拨打epoll_wait之前发生在epoll群上的所有事件一样。 epoll is designed to be used this way so do not worry about this kind of usage. epoll旨在以这种方式使用,所以不要担心这种用法。 As long as you handle all of the events which had been triggered at the time epoll_wait returns you need not worry about any which happens between calls to it, they will be caught next time you call it. 只要您处理epoll_wait返回时触发的所有事件,您无需担心在调用它之间发生的任何事件,它们将在您下次调用时被捕获。

Basically: Your usage is fine, keep going :) 基本上:你的用法很好,继续:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM