MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / aeCreateTimeEvent

Function aeCreateTimeEvent

src/ae.cpp:495–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495extern "C" long long aeCreateTimeEvent(aeEventLoop *eventLoop, long long milliseconds,
496 aeTimeProc *proc, void *clientData,
497 aeEventFinalizerProc *finalizerProc)
498{
499 serverAssert(g_eventLoopThisThread == NULL || g_eventLoopThisThread == eventLoop);
500 long long id = eventLoop->timeEventNextId++;
501 aeTimeEvent *te;
502
503 te = (aeTimeEvent*)zmalloc(sizeof(*te), MALLOC_LOCAL);
504 if (te == NULL) return AE_ERR;
505 te->id = id;
506 te->when = getMonotonicUs() + milliseconds * 1000;
507 te->timeProc = proc;
508 te->finalizerProc = finalizerProc;
509 te->clientData = clientData;
510 te->prev = NULL;
511 te->next = eventLoop->timeEventHead;
512 te->refcount = 0;
513 if (te->next)
514 te->next->prev = te;
515 eventLoop->timeEventHead = te;
516 return id;
517}
518
519extern "C" int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id)
520{

Callers 6

performEvictionsFunction · 0.85
createBenchmarkThreadFunction · 0.85
mainFunction · 0.85
initServerThreadFunction · 0.85
initServerFunction · 0.85
RM_CreateTimerFunction · 0.85

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected