Edge Triggered epoll c
Asked Answered
D

1

7

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. 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?

Diplomatic answered 3/8, 2014 at 14:43 Comment(2)
If the data available hadn't already been read away be ongoing reads, you should get another event.Quiff
OK thanks, just to be clear I am talking about a different socket becoming readable than the one already being read, so the data will not be caught by the ongoing reads (unless I am doing this wrong of course)!Diplomatic
S
4

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 is designed to be used this way so do not worry about this kind of usage. 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.

Basically: Your usage is fine, keep going :)

Shulamith answered 12/8, 2014 at 12:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.