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

Function workerThreadMain

src/server.cpp:7365–7398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7363}
7364
7365void *workerThreadMain(void *parg)
7366{
7367 int iel = (int)((int64_t)parg);
7368 serverLog(LL_NOTICE, "Thread %d alive.", iel);
7369 serverTL = g_pserver->rgthreadvar+iel; // set the TLS threadsafe global
7370 tlsInitThread();
7371
7372 if (iel != IDX_EVENT_LOOP_MAIN)
7373 {
7374 aeThreadOnline();
7375 aeAcquireLock();
7376 initNetworkingThread(iel, cserver.cthreads > 1);
7377 aeReleaseLock();
7378 aeThreadOffline();
7379 }
7380
7381 moduleAcquireGIL(true); // Normally afterSleep acquires this, but that won't be called on the first run
7382 aeThreadOnline();
7383 aeEventLoop *el = g_pserver->rgthreadvar[iel].el;
7384 try
7385 {
7386 aeMain(el);
7387 }
7388 catch (ShutdownException)
7389 {
7390 }
7391 aeThreadOffline();
7392 moduleReleaseGIL(true);
7393 serverAssert(!GlobalLocksAcquired());
7394 aeDeleteEventLoop(el);
7395
7396 tlsCleanupThread();
7397 return NULL;
7398}
7399
7400static void validateConfiguration()
7401{

Callers

nothing calls this directly

Calls 13

serverLogFunction · 0.85
tlsInitThreadFunction · 0.85
aeThreadOnlineFunction · 0.85
aeAcquireLockFunction · 0.85
initNetworkingThreadFunction · 0.85
aeReleaseLockFunction · 0.85
aeThreadOfflineFunction · 0.85
moduleAcquireGILFunction · 0.85
aeMainFunction · 0.85
moduleReleaseGILFunction · 0.85
GlobalLocksAcquiredFunction · 0.85
aeDeleteEventLoopFunction · 0.85

Tested by

no test coverage detected