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

Function aeApiCreate

app/redis-6.2.6/src/ae_ff_kqueue.c:65–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65static int aeApiCreate(aeEventLoop *eventLoop) {
66 aeApiState *state = zmalloc(sizeof(aeApiState));
67
68 if (!state) return -1;
69 state->events = zmalloc(sizeof(struct kevent)*eventLoop->setsize);
70 if (!state->events) {
71 zfree(state);
72 return -1;
73 }
74 state->kqfd = ff_kqueue();
75 if (state->kqfd == -1) {
76 zfree(state->events);
77 zfree(state);
78 return -1;
79 }
80 anetCloexec(state->kqfd);
81 state->eventsMask = zmalloc(EVENT_MASK_MALLOC_SIZE(eventLoop->setsize));
82 memset(state->eventsMask, 0, EVENT_MASK_MALLOC_SIZE(eventLoop->setsize));
83 eventLoop->apidata = state;
84 return 0;
85}
86
87static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
88 aeApiState *state = eventLoop->apidata;

Callers

nothing calls this directly

Calls 5

zmallocFunction · 0.85
ff_kqueueFunction · 0.85
anetCloexecFunction · 0.85
memsetFunction · 0.85
zfreeFunction · 0.70

Tested by

no test coverage detected