MCPcopy Create free account
hub / github.com/F-Stack/f-stack / aeApiPoll

Function aeApiPoll

app/redis-6.2.6/src/ae_epoll.c:109–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
110 aeApiState *state = eventLoop->apidata;
111 int retval, numevents = 0;
112
113 retval = epoll_wait(state->epfd,state->events,eventLoop->setsize,
114 tvp ? (tvp->tv_sec*1000 + (tvp->tv_usec + 999)/1000) : -1);
115 if (retval > 0) {
116 int j;
117
118 numevents = retval;
119 for (j = 0; j < numevents; j++) {
120 int mask = 0;
121 struct epoll_event *e = state->events+j;
122
123 if (e->events & EPOLLIN) mask |= AE_READABLE;
124 if (e->events & EPOLLOUT) mask |= AE_WRITABLE;
125 if (e->events & EPOLLERR) mask |= AE_WRITABLE|AE_READABLE;
126 if (e->events & EPOLLHUP) mask |= AE_WRITABLE|AE_READABLE;
127 eventLoop->fired[j].fd = e->data.fd;
128 eventLoop->fired[j].mask = mask;
129 }
130 }
131 return numevents;
132}
133
134static char *aeApiName(void) {
135 return "epoll";

Callers 1

aeProcessEventsFunction · 0.70

Calls 1

epoll_waitFunction · 0.85

Tested by

no test coverage detected