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

Function background_work

deps/jemalloc/src/background_thread.c:482–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482static void
483background_work(tsd_t *tsd, unsigned ind) {
484 background_thread_info_t *info = &background_thread_info[ind];
485
486 malloc_mutex_lock(tsd_tsdn(tsd), &info->mtx);
487 background_thread_wakeup_time_set(tsd_tsdn(tsd), info,
488 BACKGROUND_THREAD_INDEFINITE_SLEEP);
489 if (ind == 0) {
490 background_thread0_work(tsd);
491 } else {
492 while (info->state != background_thread_stopped) {
493 if (background_thread_pause_check(tsd_tsdn(tsd),
494 info)) {
495 continue;
496 }
497 background_work_sleep_once(tsd_tsdn(tsd), info, ind);
498 }
499 }
500 assert(info->state == background_thread_stopped);
501 background_thread_wakeup_time_set(tsd_tsdn(tsd), info, 0);
502 malloc_mutex_unlock(tsd_tsdn(tsd), &info->mtx);
503}
504
505static void *
506background_thread_entry(void *ind_arg) {

Callers 1

background_thread_entryFunction · 0.70

Calls 7

background_thread0_workFunction · 0.70
malloc_mutex_lockFunction · 0.50
tsd_tsdnFunction · 0.50
malloc_mutex_unlockFunction · 0.50

Tested by

no test coverage detected