aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread/Name.hxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/thread/Name.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/thread/Name.hxx b/src/thread/Name.hxx
index 0edcc0242..872702af2 100644
--- a/src/thread/Name.hxx
+++ b/src/thread/Name.hxx
@@ -21,10 +21,14 @@
#define MPD_THREAD_NAME_HXX
#ifdef HAVE_PTHREAD_SETNAME_NP
+# define HAVE_THREAD_NAME
# include <pthread.h>
# include <stdio.h>
#elif defined(HAVE_PRCTL)
# include <sys/prctl.h>
+# ifdef PR_SET_NAME
+# define HAVE_THREAD_NAME
+# endif
#endif
static inline void
@@ -47,7 +51,7 @@ template<typename... Args>
static inline void
FormatThreadName(const char *fmt, gcc_unused Args&&... args)
{
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#ifdef HAVE_THREAD_NAME
char buffer[16];
snprintf(buffer, sizeof(buffer), fmt, args...);
SetThreadName(buffer);