From: Willy Tarreau Date: Wed, 15 Sep 2021 08:12:04 +0000 (+0200) Subject: BUILD: threads: fix -Wundef for _POSIX_PRIORITY_SCHEDULING on libmusl X-Git-Tag: v2.5-dev8~198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ab941939480af65660182e343df22fcdced6005;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index 51c7278489..9cf66476c3 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();