diff --git a/iio-config.h.cmakein b/iio-config.h.cmakein index e3ea030a0..55fb17c6b 100644 --- a/iio-config.h.cmakein +++ b/iio-config.h.cmakein @@ -43,6 +43,7 @@ #cmakedefine01 HAVE_AVAHI #cmakedefine01 WITH_ZSTD #cmakedefine01 NO_THREADS +#cmakedefine01 HAS_PTHREAD_SETNAME_NP #cmakedefine HAS_PIPE2 #cmakedefine HAS_STRDUP @@ -50,7 +51,6 @@ #cmakedefine HAS_STRTOK_R #cmakedefine HAS_STRERROR_R #cmakedefine HAS_NEWLOCALE -#cmakedefine HAS_PTHREAD_SETNAME_NP #cmakedefine HAVE_IPV6 #define IF_ENABLED(cfg, ptr) ((cfg) ? (ptr) : NULL) diff --git a/iiod/thread-pool.c b/iiod/thread-pool.c index 2e8b8709e..4c8d5a75c 100644 --- a/iiod/thread-pool.c +++ b/iiod/thread-pool.c @@ -6,6 +6,7 @@ * Author: Paul Cercueil */ +#include "iio-config.h" #include "thread-pool.h" #include @@ -101,10 +102,8 @@ int thread_pool_add_thread(struct thread_pool *pool, if (ret) { free(pdata); thread_pool_thread_stopped(pool); - } else { -#ifdef HAS_PTHREAD_SETNAME_NP + } else if (HAS_PTHREAD_SETNAME_NP) { pthread_setname_np(thd, name); -#endif } pthread_attr_destroy(&attr);