[master] 89ef96445 Use pthread_set_name_np when it available

Nils Goroll nils.goroll at uplex.de
Wed May 28 15:08:05 UTC 2025


commit 89ef96445c7d6a42250e09725577c35b06560161
Author: Kirill A. Korinsky <kirill at korins.ky>
Date:   Tue Nov 19 20:42:10 2024 +0100

    Use pthread_set_name_np when it available

diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index c74292bdb..32a44e3ea 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -163,6 +163,8 @@ THR_SetName(const char *name)
 #  else
 	thr_setname_generic(name);
 #  endif
+#elif defined(HAVE_PTHREAD_SET_NAME_NP)
+	(void)pthread_set_name_np(pthread_self(), name);
 #endif
 }
 
diff --git a/configure.ac b/configure.ac
index 8511d08c2..2483dfeac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,7 @@ AC_CHECK_FUNCS([fnmatch], [], [AC_MSG_ERROR([fnmatch(3) is required])])
 save_LIBS="${LIBS}"
 LIBS="${PTHREAD_LIBS}"
 AC_CHECK_FUNCS([pthread_setname_np])
+AC_CHECK_FUNCS([pthread_set_name_np])
 AC_CHECK_FUNCS([pthread_mutex_isowned_np])
 AC_CHECK_FUNCS([pthread_getattr_np])
 LIBS="${save_LIBS}"


More information about the varnish-commit mailing list