Make use of pthread_set_name_np(3) on FreeBSD.

This commit is contained in:
Edward Tomasz Napierala 2018-10-06 16:43:07 +01:00 committed by Qi Wang
parent 936bc2aa15
commit ceba1dde27
2 changed files with 5 additions and 0 deletions

View File

@ -31,6 +31,9 @@
# include <sys/uio.h> # include <sys/uio.h>
# endif # endif
# include <pthread.h> # include <pthread.h>
# ifdef __FreeBSD__
# include <pthread_np.h>
# endif
# include <signal.h> # include <signal.h>
# ifdef JEMALLOC_OS_UNFAIR_LOCK # ifdef JEMALLOC_OS_UNFAIR_LOCK
# include <os/lock.h> # include <os/lock.h>

View File

@ -509,6 +509,8 @@ background_thread_entry(void *ind_arg) {
assert(thread_ind < max_background_threads); assert(thread_ind < max_background_threads);
#ifdef JEMALLOC_HAVE_PTHREAD_SETNAME_NP #ifdef JEMALLOC_HAVE_PTHREAD_SETNAME_NP
pthread_setname_np(pthread_self(), "jemalloc_bg_thd"); pthread_setname_np(pthread_self(), "jemalloc_bg_thd");
#elif defined(__FreeBSD__)
pthread_set_name_np(pthread_self(), "jemalloc_bg_thd");
#endif #endif
if (opt_percpu_arena != percpu_arena_disabled) { if (opt_percpu_arena != percpu_arena_disabled) {
set_current_thread_affinity((int)thread_ind); set_current_thread_affinity((int)thread_ind);