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

Function background_thread_entry

deps/jemalloc/src/background_thread.c:505–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505static void *
506background_thread_entry(void *ind_arg) {
507 unsigned thread_ind = (unsigned)(uintptr_t)ind_arg;
508 assert(thread_ind < max_background_threads);
509#ifdef JEMALLOC_HAVE_PTHREAD_SETNAME_NP
510 pthread_setname_np(pthread_self(), "jemalloc_bg_thd");
511#elif defined(__FreeBSD__)
512 pthread_set_name_np(pthread_self(), "jemalloc_bg_thd");
513#endif
514 if (opt_percpu_arena != percpu_arena_disabled) {
515 set_current_thread_affinity((int)thread_ind);
516 }
517 /*
518 * Start periodic background work. We use internal tsd which avoids
519 * side effects, for example triggering new arena creation (which in
520 * turn triggers another background thread creation).
521 */
522 background_work(tsd_internal_fetch(), thread_ind);
523 assert(pthread_equal(pthread_self(),
524 background_thread_info[thread_ind].thread));
525
526 return NULL;
527}
528
529static void
530background_thread_init(tsd_t *tsd, background_thread_info_t *info) {

Callers

nothing calls this directly

Calls 3

background_workFunction · 0.70
tsd_internal_fetchFunction · 0.50

Tested by

no test coverage detected