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

Function tsd_fetch_slow

deps/jemalloc/src/tsd.c:269–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269tsd_t *
270tsd_fetch_slow(tsd_t *tsd, bool minimal) {
271 assert(!tsd_fast(tsd));
272
273 if (tsd_state_get(tsd) == tsd_state_nominal_slow) {
274 /*
275 * On slow path but no work needed. Note that we can't
276 * necessarily *assert* that we're slow, because we might be
277 * slow because of an asynchronous modification to global state,
278 * which might be asynchronously modified *back*.
279 */
280 } else if (tsd_state_get(tsd) == tsd_state_nominal_recompute) {
281 tsd_slow_update(tsd);
282 } else if (tsd_state_get(tsd) == tsd_state_uninitialized) {
283 if (!minimal) {
284 if (tsd_booted) {
285 tsd_state_set(tsd, tsd_state_nominal);
286 tsd_slow_update(tsd);
287 /* Trigger cleanup handler registration. */
288 tsd_set(tsd);
289 tsd_data_init(tsd);
290 }
291 } else {
292 tsd_state_set(tsd, tsd_state_minimal_initialized);
293 tsd_set(tsd);
294 tsd_data_init_nocleanup(tsd);
295 }
296 } else if (tsd_state_get(tsd) == tsd_state_minimal_initialized) {
297 if (!minimal) {
298 /* Switch to fully initialized. */
299 tsd_state_set(tsd, tsd_state_nominal);
300 assert(*tsd_reentrancy_levelp_get(tsd) >= 1);
301 (*tsd_reentrancy_levelp_get(tsd))--;
302 tsd_slow_update(tsd);
303 tsd_data_init(tsd);
304 } else {
305 assert_tsd_data_cleanup_done(tsd);
306 }
307 } else if (tsd_state_get(tsd) == tsd_state_purgatory) {
308 tsd_state_set(tsd, tsd_state_reincarnated);
309 tsd_set(tsd);
310 tsd_data_init_nocleanup(tsd);
311 } else {
312 assert(tsd_state_get(tsd) == tsd_state_reincarnated);
313 }
314
315 return tsd;
316}
317
318void *
319malloc_tsd_malloc(size_t size) {

Callers 1

tsd_fetch_implFunction · 0.50

Calls 8

tsd_state_getFunction · 0.85
tsd_state_setFunction · 0.85
tsd_slow_updateFunction · 0.70
tsd_data_initFunction · 0.70
tsd_data_init_nocleanupFunction · 0.70
tsd_fastFunction · 0.50
tsd_setFunction · 0.50

Tested by

no test coverage detected