From 8ab941939480af65660182e343df22fcdced6005 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 15 Sep 2021 10:12:04 +0200 Subject: [PATCH] BUILD: threads: fix -Wundef for _POSIX_PRIORITY_SCHEDULING on libmusl Building with an old musl-based toolchain reported this warning: include/haproxy/thread.h: In function 'ha_thread_relax': include/haproxy/thread.h:256:5: warning: "_POSIX_PRIORITY_SCHEDULING" is not defined [-Wundef] #if _POSIX_PRIORITY_SCHEDULING ^ There were indeed two "#if" insteadd of #ifdef" for this macro, let's fix them. --- include/haproxy/thread.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index 51c727848..9cf66476c 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -103,7 +103,7 @@ static inline unsigned long long ha_get_pthread_id(unsigned int thr) static inline void ha_thread_relax(void) { -#if _POSIX_PRIORITY_SCHEDULING +#ifdef _POSIX_PRIORITY_SCHEDULING sched_yield(); #endif } @@ -253,7 +253,7 @@ static inline unsigned long long ha_get_pthread_id(unsigned int thr) static inline void ha_thread_relax(void) { -#if _POSIX_PRIORITY_SCHEDULING +#ifdef _POSIX_PRIORITY_SCHEDULING sched_yield(); #else pl_cpu_relax();