File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
include/jemalloc/internal Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1470,6 +1470,15 @@ if test "x$abi" != "xpecoff" ; then
14701470 if test "x${je_cv_pthread_atfork}" = "xyes" ; then
14711471 AC_DEFINE ( [ JEMALLOC_HAVE_PTHREAD_ATFORK] , [ ] )
14721472 fi
1473+ dnl Check if pthread_setname_np is available with the expected API.
1474+ JE_COMPILABLE([ pthread_setname_np(3)] , [
1475+ #include <pthread.h>
1476+ ] , [
1477+ pthread_setname_np(pthread_self(), "setname_test");
1478+ ] , [ je_cv_pthread_setname_np] )
1479+ if test "x${je_cv_pthread_setname_np}" = "xyes" ; then
1480+ AC_DEFINE ( [ JEMALLOC_HAVE_PTHREAD_SETNAME_NP] , [ ] )
1481+ fi
14731482fi
14741483
14751484JE_APPEND_VS(CPPFLAGS, -D_REENTRANT)
Original file line number Diff line number Diff line change 9898/* Defined if pthread_atfork(3) is available. */
9999#undef JEMALLOC_HAVE_PTHREAD_ATFORK
100100
101+ /* Defined if pthread_setname_np(3) is available. */
102+ #undef JEMALLOC_HAVE_PTHREAD_SETNAME_NP
103+
101104/*
102105 * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
103106 */
Original file line number Diff line number Diff line change @@ -499,7 +499,9 @@ static void *
499499background_thread_entry (void * ind_arg ) {
500500 unsigned thread_ind = (unsigned )(uintptr_t )ind_arg ;
501501 assert (thread_ind < ncpus );
502-
502+ #ifdef JEMALLOC_HAVE_PTHREAD_SETNAME_NP
503+ pthread_setname_np (pthread_self (), "jemalloc_bg_thd" );
504+ #endif
503505 if (opt_percpu_arena != percpu_arena_disabled ) {
504506 set_current_thread_affinity ((int )thread_ind );
505507 }
You can’t perform that action at this time.
0 commit comments