u_thread: Use pthread_setname_np on linux only.
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 13 Jan 2018 11:33:15 +0000 (12:33 +0100)
committerJose Fonseca <jfonseca@vmware.com>
Mon, 22 Jan 2018 21:12:41 +0000 (21:12 +0000)
pthread_setname_np was added in glibc 2.12 for the Linux port only, other
ports do not necessarily have it.

Signed-off-by: Jose Fonseca <jfonseca@vmware.com>
src/util/u_thread.h

index 26cc0b0934bfc94c7ecd50fbecd3699955bc1938..8c6e0bdc59e9669a7dd21be06d39a1805a986eaa 100644 (file)
@@ -62,7 +62,8 @@ static inline void u_thread_setname( const char *name )
 {
 #if defined(HAVE_PTHREAD)
 #  if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
-      (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
+      (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
+      defined(__linux__)
    pthread_setname_np(pthread_self(), name);
 #  endif
 #endif