aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-06 12:08:36 +0100
committerMax Kellermann <max@duempel.org>2015-01-06 12:08:36 +0100
commit4bd2c75056271e687e26c4d8038bdefaa7c88dc9 (patch)
treeb517f97c3e15fc7bb653e79ba83e6f8e7adeb913 /src/thread
parentb9ed850b98ff793b43482cc501505f873335bdb1 (diff)
downloadmpd-4bd2c75056271e687e26c4d8038bdefaa7c88dc9.tar.gz
mpd-4bd2c75056271e687e26c4d8038bdefaa7c88dc9.tar.xz
mpd-4bd2c75056271e687e26c4d8038bdefaa7c88dc9.zip
thread/Name: disable pthread_setname_np() on NetBSD
NetBSD's pthread_setname_np() prototype is incompatible with the rest of the world, and it requires to pass the string argument as a non-const pointer. Instead of working around this misdesign, I hereby disable the feature on NetBSD.
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/Name.hxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/thread/Name.hxx b/src/thread/Name.hxx
index 872702af2..0fbad0fd2 100644
--- a/src/thread/Name.hxx
+++ b/src/thread/Name.hxx
@@ -20,7 +20,7 @@
#ifndef MPD_THREAD_NAME_HXX
#define MPD_THREAD_NAME_HXX
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__NetBSD__)
# define HAVE_THREAD_NAME
# include <pthread.h>
# include <stdio.h>
@@ -34,7 +34,11 @@
static inline void
SetThreadName(const char *name)
{
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__NetBSD__)
+ /* not using pthread_setname_np() on NetBSD because it
+ requires a non-const pointer argument, which we don't have
+ here */
+
#ifdef __APPLE__
pthread_setname_np(name);
#else