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

Function _init_init_lock

deps/memkind/src/jemalloc/src/jemalloc.c:133–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131
132JEMALLOC_ATTR(constructor)
133static void WINAPI
134_init_init_lock(void) {
135 /*
136 * If another constructor in the same binary is using mallctl to e.g.
137 * set up extent hooks, it may end up running before this one, and
138 * malloc_init_hard will crash trying to lock the uninitialized lock. So
139 * we force an initialization of the lock in malloc_init_hard as well.
140 * We don't try to care about atomicity of the accessed to the
141 * init_lock_initialized boolean, since it really only matters early in
142 * the process creation, before any separate thread normally starts
143 * doing anything.
144 */
145 if (!init_lock_initialized) {
146 malloc_mutex_init(&init_lock, "init", WITNESS_RANK_INIT,
147 malloc_mutex_rank_exclusive);
148 }
149 init_lock_initialized = true;
150}
151
152#ifdef _MSC_VER
153# pragma section(".CRT$XCU", read)

Callers 1

malloc_init_hardFunction · 0.70

Calls 1

malloc_mutex_initFunction · 0.70

Tested by

no test coverage detected