diff --git a/old-configure b/old-configure index 0d1ff4cb17..fcf35ef5ac 100755 --- a/old-configure +++ b/old-configure @@ -993,6 +993,7 @@ cat > $TMPC << EOF #define HAVE_GLIBC_THREAD_NAME (!!__GLIBC__) #define HAVE_OSX_THREAD_NAME 0 #define HAVE_BSD_THREAD_NAME 0 +#define HAVE_NETBSD_THREAD_NAME 0 #define DEFAULT_CDROM_DEVICE "/dev/cdrom" #define DEFAULT_DVD_DEVICE "/dev/dvd" diff --git a/osdep/threads.c b/osdep/threads.c index 7a6174eb79..6ef08dbf49 100644 --- a/osdep/threads.c +++ b/osdep/threads.c @@ -19,6 +19,10 @@ #include "config.h" +#if HAVE_BSD_THREAD_NAME +#include +#endif + #include "threads.h" #include "timer.h" @@ -56,6 +60,8 @@ void mpthread_set_name(const char *name) } #elif HAVE_BSD_THREAD_NAME pthread_set_name_np(pthread_self(), tname); +#elif HAVE_NETBSD_THREAD_NAME + pthread_setname_np(pthread_self(), "%s", (void *)tname); #elif HAVE_OSX_THREAD_NAME pthread_setname_np(tname); #endif diff --git a/wscript b/wscript index 3eadc37aef..58d8e1e55e 100644 --- a/wscript +++ b/wscript @@ -227,9 +227,16 @@ iconv support use --disable-iconv.", 'name': 'bsd-thread-name', 'desc': 'BSD API for setting thread name', 'deps_neg': [ 'glibc-thread-name', 'osx-thread-name' ], - 'func': check_statement('pthread.h', + 'func': check_statement(['pthread.h', 'pthread_np.h'], 'pthread_set_name_np(pthread_self(), "ducks")', use=['pthreads']), + }, { + 'name': 'netbsd-thread-name', + 'desc': 'NetBSD API for setting thread name', + 'deps_neg': [ 'glibc-thread-name', 'osx-thread-name', 'bsd-thread-name' ], + 'func': check_statement('pthread.h', + 'pthread_setname_np(pthread_self(), "%s", (void *)"ducks")', + use=['pthreads']), }, { 'name': 'bsd-fstatfs', 'desc': "BSD's fstatfs()",