c - maxevents parameter in epoll_wait() and the events array size -


in epoll usage, following:

struct epoll_event ev,events[20]; epfd=epoll_create(256); 。。。 nfds=epoll_wait(epfd,events,40,500); 

some articles saying maxevents parameter in epoll_wait (namely 40 in epoll_wait(epfd,events,40,500);) should not exceed size parameter in epoll_create(namely 256).

i think maxevents parameter should not exceed 20 in ev, events[20], because events can registered 20 events elements; otherwise, if there 40 sockets active, happen?

btw, if register more 20 sockets , there more 20 active events(sockets), events array events[20] has 20 events, happen?

at single call of epoll_wait you'll @ receive many events have room for, of course events don't lost if there more queued -- you'll them @ later call. since you'll calling epoll_wait in loop anyway, shouldn't issue @ all.

the 1 interesting consideration can think of when have multiple threads read same epoll-fd concurrently. in case size of event array determines how many events handled single thread (i.e. smaller number might give greater parallelism).


Comments

Popular posts from this blog

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -