From b9ed850b98ff793b43482cc501505f873335bdb1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 6 Jan 2015 12:04:02 +0100 Subject: thread/Name: enable FormatThreadName() with prctl() Add macro HAVE_THREAD_NAME which is set when any method to set the thread name is available. Use that macro in FormatThreadName() instead of just checking for HAVE_PTHREAD_SETNAME_NP. --- src/thread/Name.hxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 # include #elif defined(HAVE_PRCTL) # include +# ifdef PR_SET_NAME +# define HAVE_THREAD_NAME +# endif #endif static inline void @@ -47,7 +51,7 @@ template 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); -- cgit v1.2.3