diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c index f33aea55d0..91fbdf6b38 100644 --- a/bin/varnishd/cache/cache_main.c +++ b/bin/varnishd/cache/cache_main.c @@ -152,6 +152,9 @@ THR_SetName(const char *name) { PTOK(pthread_setspecific(name_key, name)); +#if defined(HAVE_PTHREAD_SET_NAME_NP) + pthread_set_name_np(pthread_self(), name); +#elif defined(HAVE_PTHREAD_SETNAME_NP) #if defined(__APPLE__) (void)pthread_setname_np(name); #elif defined(__NetBSD__) @@ -159,6 +162,7 @@ THR_SetName(const char *name) #else thr_setname_generic(name); #endif +#endif } const char * diff --git a/configure.ac b/configure.ac index 44e1ed879c..54b8c9f3ae 100644 --- a/configure.ac +++ b/configure.ac @@ -227,6 +227,8 @@ AC_CHECK_FUNCS([fnmatch], [], [AC_MSG_ERROR([fnmatch(3) is required])]) save_LIBS="${LIBS}" LIBS="${PTHREAD_LIBS}" +AC_CHECK_FUNCS([pthread_set_name_np]) +AC_CHECK_FUNCS([pthread_setname_np]) AC_CHECK_FUNCS([pthread_mutex_isowned_np]) AC_CHECK_FUNCS([pthread_getattr_np]) LIBS="${save_LIBS}"