In epoll usage, it is usually like the following:
struct epoll_event ev,events[20];
epfd=epoll_create(256);
。。。
nfds=epoll_wait(epfd,events,40,500);
Some articles are saying that the maxevents
parameter in epoll_wait
(namely the 40
in epoll_wait(epfd,events,40,500);
) should not exceed the size parameter in epoll_create
(namely the 256
).
I think the maxevents
parameter should not exceed 20
in ev, events[20]
, because events can only be registered to 20 events elements; otherwise, if there are 40 sockets which are active, then what will happen?
BTW, if I register more than 20 sockets and there are more than 20 active events(sockets), but the events array events[20]
has only 20 events, what will happen?