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

Function malloc_init_hard_needed

app/redis-6.2.6/deps/jemalloc/src/jemalloc.c:1248–1272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1246}
1247
1248static bool
1249malloc_init_hard_needed(void) {
1250 if (malloc_initialized() || (IS_INITIALIZER && malloc_init_state ==
1251 malloc_init_recursible)) {
1252 /*
1253 * Another thread initialized the allocator before this one
1254 * acquired init_lock, or this thread is the initializing
1255 * thread, and it is recursively allocating.
1256 */
1257 return false;
1258 }
1259#ifdef JEMALLOC_THREADED_INIT
1260 if (malloc_initializer != NO_INITIALIZER && !IS_INITIALIZER) {
1261 /* Busy-wait until the initializing thread completes. */
1262 spin_t spinner = SPIN_INITIALIZER;
1263 do {
1264 malloc_mutex_unlock(TSDN_NULL, &init_lock);
1265 spin_adaptive(&spinner);
1266 malloc_mutex_lock(TSDN_NULL, &init_lock);
1267 } while (!malloc_initialized());
1268 return false;
1269 }
1270#endif
1271 return true;
1272}
1273
1274static bool
1275malloc_init_hard_a0_locked() {

Callers 1

malloc_init_hardFunction · 0.85

Calls 4

malloc_initializedFunction · 0.85
malloc_mutex_unlockFunction · 0.85
spin_adaptiveFunction · 0.85
malloc_mutex_lockFunction · 0.85

Tested by

no test coverage detected