From: Willy Tarreau Date: Thu, 3 Apr 2025 09:59:31 +0000 (+0200) Subject: CLEANUP: atomics: also replace __sync_synchronize() with __atomic_thread_fence() X-Git-Tag: v3.2-dev10~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f435a2e518;p=thirdparty%2Fhaproxy.git CLEANUP: atomics: also replace __sync_synchronize() with __atomic_thread_fence() The drop of older compilers also allows us to focus on clearer barriers, so let's use them. --- diff --git a/include/haproxy/atomic.h b/include/haproxy/atomic.h index 5f5a06601..36e024603 100644 --- a/include/haproxy/atomic.h +++ b/include/haproxy/atomic.h @@ -685,12 +685,13 @@ static __inline int __ha_cas_dw(void *target, void *compare, void *set) #else /* unknown / unhandled architecture, fall back to generic barriers */ -#define __ha_barrier_atomic_load __sync_synchronize -#define __ha_barrier_atomic_store __sync_synchronize -#define __ha_barrier_atomic_full __sync_synchronize -#define __ha_barrier_load __sync_synchronize -#define __ha_barrier_store __sync_synchronize -#define __ha_barrier_full __sync_synchronize +#define __ha_barrier_atomic_load __atomic_thread_fence(__ATOMIC_ACQUIRE) +#define __ha_barrier_atomic_store __atomic_thread_fence(__ATOMIC_RELEASE) +#define __ha_barrier_atomic_full __atomic_thread_fence(__ATOMIC_SEQ_CST) +#define __ha_barrier_load __atomic_thread_fence(__ATOMIC_ACQUIRE) +#define __ha_barrier_store __atomic_thread_fence(__ATOMIC_RELEASE) +#define __ha_barrier_full __atomic_thread_fence(__ATOMIC_SEQ_CST) + /* Note: there is no generic DWCAS */ /* short-lived CPU relaxation */