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

Function aeResizeSetSize

app/redis-6.2.6/src/ae.c:125–141  ·  view source on GitHub ↗

Resize the maximum set size of the event loop. * If the requested set size is smaller than the current set size, but * there is already a file descriptor in use that is >= the requested * set size minus one, AE_ERR is returned and the operation is not * performed at all. * * Otherwise AE_OK is returned and the operation is successful. */

Source from the content-addressed store, hash-verified

123 *
124 * Otherwise AE_OK is returned and the operation is successful. */
125int aeResizeSetSize(aeEventLoop *eventLoop, int setsize) {
126 int i;
127
128 if (setsize == eventLoop->setsize) return AE_OK;
129 if (eventLoop->maxfd >= setsize) return AE_ERR;
130 if (aeApiResize(eventLoop,setsize) == -1) return AE_ERR;
131
132 eventLoop->events = zrealloc(eventLoop->events,sizeof(aeFileEvent)*setsize);
133 eventLoop->fired = zrealloc(eventLoop->fired,sizeof(aeFiredEvent)*setsize);
134 eventLoop->setsize = setsize;
135
136 /* Make sure that if we created new slots, they are initialized with
137 * an AE_NONE mask. */
138 for (i = eventLoop->maxfd+1; i < setsize; i++)
139 eventLoop->events[i].mask = AE_NONE;
140 return AE_OK;
141}
142
143void aeDeleteEventLoop(aeEventLoop *eventLoop) {
144 aeApiFree(eventLoop);

Callers 1

updateMaxclientsFunction · 0.85

Calls 2

zreallocFunction · 0.85
aeApiResizeFunction · 0.70

Tested by

no test coverage detected