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

Function moduleInitModulesSystem

app/redis-6.2.6/src/module.c:8441–8481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8439}
8440
8441void moduleInitModulesSystem(void) {
8442 moduleUnblockedClients = listCreate();
8443 server.loadmodule_queue = listCreate();
8444 modules = dictCreate(&modulesDictType,NULL);
8445
8446 /* Set up the keyspace notification subscriber list and static client */
8447 moduleKeyspaceSubscribers = listCreate();
8448
8449 /* Set up filter list */
8450 moduleCommandFilters = listCreate();
8451
8452 /* Reusable client for RM_Call() is created on first use */
8453 server.module_client = NULL;
8454
8455 moduleRegisterCoreAPI();
8456 if (pipe(server.module_blocked_pipe) == -1) {
8457 serverLog(LL_WARNING,
8458 "Can't create the pipe for module blocking commands: %s",
8459 strerror(errno));
8460 exit(1);
8461 }
8462 /* Make the pipe non blocking. This is just a best effort aware mechanism
8463 * and we do not want to block not in the read nor in the write half. */
8464 anetNonBlock(NULL,server.module_blocked_pipe[0]);
8465 anetNonBlock(NULL,server.module_blocked_pipe[1]);
8466
8467 /* Enable close-on-exec flag on pipes in case of the fork-exec system calls in
8468 * sentinels or redis servers. */
8469 anetCloexec(server.module_blocked_pipe[0]);
8470 anetCloexec(server.module_blocked_pipe[1]);
8471
8472 /* Create the timers radix tree. */
8473 Timers = raxNew();
8474
8475 /* Setup the event listeners data structures. */
8476 RedisModule_EventListeners = listCreate();
8477
8478 /* Our thread-safe contexts GIL must start with already locked:
8479 * it is just unlocked when it's safe. */
8480 pthread_mutex_lock(&moduleGIL);
8481}
8482
8483/* Load all the modules in the server.loadmodule_queue list, which is
8484 * populated by `loadmodule` directives in the configuration file.

Callers 1

mainFunction · 0.85

Calls 8

listCreateFunction · 0.85
moduleRegisterCoreAPIFunction · 0.85
anetNonBlockFunction · 0.85
anetCloexecFunction · 0.85
raxNewFunction · 0.85
pthread_mutex_lockFunction · 0.85
dictCreateFunction · 0.70
pipeClass · 0.50

Tested by

no test coverage detected