Home > OS >  LinuxI/O multiplexing in doubt about epoll_wait
LinuxI/O multiplexing in doubt about epoll_wait

Time:10-06

Function prototypes: int epoll_wait (int epfd, struct epoll_event * events, int maxevents, int timeout);
Epfd: special epoll file descriptor
Distribution of events: good epoll_event structure array
Maxevents: maxevents said this returns the largest number of events
Timeout: timeout milliseconds,
Return value: success: returns to meet the number of events to monitor conditions, such as return 0 says it has timeout

There is no clear epoll_wait () under what circumstances return is it , if it is in a ready has detected event is returned, in addition to multiple events are ready at the same time, under normal circumstances should return 1? What is the role of the maxevents parameters?
In addition to more than one event is ready at the same time there are other things will return the value of greater than 1?

CodePudding user response:

Epoll_wait () every time will put every access to trigger events in the events in this array of events, and maxevents represent the maximum capacity of the array, so also is every epoll can access to the largest number of events,
Epoll_wait (), the return value is the access to the actual number of events, which is the number of events to be processed,
Epoll_wait () what the hell situation returns this associated with event trigger mode, ET and LT two modes,
  • Related