c++clinuxepollet

Can epoll_wait() > 1 with only 1 socket and 1 event -- EPOLLIN?


Let's say I epoll_create1() and only interest in EPOLLIN | EPOLLET for 1 socket.

Is it possible that I will get epoll_wait() > 1 (assuming timeout=-1) for that socket and the event is EPOLLIN?

Or will epoll_wait() return 1 even there are multiple packets (let's say spread over few sec that I pause the program on purpose in the epoll_wait loop)?

Thanks in advance.


Solution

  • epoll_wait returns the number of events, which according to the documentation equals the "number of file descriptors ready for I/O". So you cannot get more events than the number of file descriptors you have registered.