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

Function moduleSetThreadVariablesIfNeeded

src/module.cpp:617–622  ·  view source on GitHub ↗

This function is used to set the thread local variables (serverTL) for * arbitrary module threads. All incoming module threads share the same set of * thread local variables (modulethreadvar). * * This is needed as some KeyDB functions use thread local variables to do things, * and we don't want to share the thread local variables of existing server threads */

Source from the content-addressed store, hash-verified

615 * This is needed as some KeyDB functions use thread local variables to do things,
616 * and we don't want to share the thread local variables of existing server threads */
617void moduleSetThreadVariablesIfNeeded(void) {
618 if (serverTL == nullptr) {
619 serverTL = &g_pserver->modulethreadvar;
620 g_fModuleThread = true;
621 }
622}
623
624/* --------------------------------------------------------------------------
625 * Service API exported to modules

Callers 3

RM_AvoidReplicaTrafficFunction · 0.85
RM_UnblockClientFunction · 0.85
RM_ThreadSafeContextLockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected