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

Function afterSleep

src/server.cpp:3044–3066  ·  view source on GitHub ↗

This function is called immediately after the event loop multiplexing * API returned, and the control is going to soon return to Redis by invoking * the different events callbacks. */

Source from the content-addressed store, hash-verified

3042 * API returned, and the control is going to soon return to Redis by invoking
3043 * the different events callbacks. */
3044void afterSleep(struct aeEventLoop *eventLoop) {
3045 UNUSED(eventLoop);
3046 /* Do NOT add anything above moduleAcquireGIL !!! */
3047
3048 /* Aquire the modules GIL so that their threads won't touch anything.
3049 Don't check here that modules are enabled, rather use the result from beforeSleep
3050 Otherwise you may double acquire the GIL and cause deadlocks in the module */
3051 if (!ProcessingEventsWhileBlocked) {
3052 if (serverTL->modulesEnabledThisAeLoop) moduleAcquireGIL(TRUE /*fServerThread*/);
3053 aeThreadOnline();
3054 wakeTimeThread();
3055
3056 serverAssert(serverTL->gcEpoch.isReset());
3057 serverTL->gcEpoch = g_pserver->garbageCollector.startEpoch();
3058
3059 aeAcquireLock();
3060 for (int idb = 0; idb < cserver.dbnum; ++idb)
3061 g_pserver->db[idb]->trackChanges(false);
3062 aeReleaseLock();
3063
3064 serverTL->disable_async_commands = false;
3065 }
3066}
3067
3068/* =========================== Server initialization ======================== */
3069

Callers

nothing calls this directly

Calls 8

moduleAcquireGILFunction · 0.85
aeThreadOnlineFunction · 0.85
wakeTimeThreadFunction · 0.85
aeAcquireLockFunction · 0.85
aeReleaseLockFunction · 0.85
isResetMethod · 0.80
trackChangesMethod · 0.80
startEpochMethod · 0.45

Tested by

no test coverage detected