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

Function aeApiPoll

app/redis-6.2.6/src/ae_select.c:77–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
78 aeApiState *state = eventLoop->apidata;
79 int retval, j, numevents = 0;
80
81 memcpy(&state->_rfds,&state->rfds,sizeof(fd_set));
82 memcpy(&state->_wfds,&state->wfds,sizeof(fd_set));
83
84 retval = select(eventLoop->maxfd+1,
85 &state->_rfds,&state->_wfds,NULL,tvp);
86 if (retval > 0) {
87 for (j = 0; j <= eventLoop->maxfd; j++) {
88 int mask = 0;
89 aeFileEvent *fe = &eventLoop->events[j];
90
91 if (fe->mask == AE_NONE) continue;
92 if (fe->mask & AE_READABLE && FD_ISSET(j,&state->_rfds))
93 mask |= AE_READABLE;
94 if (fe->mask & AE_WRITABLE && FD_ISSET(j,&state->_wfds))
95 mask |= AE_WRITABLE;
96 eventLoop->fired[numevents].fd = j;
97 eventLoop->fired[numevents].mask = mask;
98 numevents++;
99 }
100 }
101 return numevents;
102}
103
104static char *aeApiName(void) {
105 return "select";

Callers

nothing calls this directly

Calls 2

selectFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected