diff --git a/thpool.c b/thpool.c index 0643bc3..83ececf 100644 --- a/thpool.c +++ b/thpool.c @@ -8,9 +8,6 @@ * ********************************/ -#if defined(__linux__) -#define _GNU_SOURCE -#endif #include #include #include @@ -18,6 +15,9 @@ #include #include #include +#if defined(__linux__) +#include +#endif #include "thpool.h" #ifdef THPOOL_DEBUG @@ -306,7 +306,8 @@ static void* thread_do(struct thread* thread_p){ sprintf(thread_name, "thread-pool-%d", thread_p->id); #if defined(__linux__) - pthread_setname_np(thread_p->pthread, thread_name); + /* Use prctl instead to prevent using _GNU_SOURCE flag and implicit declaration */ + prctl(PR_SET_NAME, thread_name); #elif defined(__APPLE__) && defined(__MACH__) pthread_setname_np(thread_name); #else