]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: atomics: also replace __sync_synchronize() with __atomic_thread_fence()
authorWilly Tarreau <w@1wt.eu>
Thu, 3 Apr 2025 09:59:31 +0000 (11:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 3 Apr 2025 09:59:31 +0000 (11:59 +0200)
The drop of older compilers also allows us to focus on clearer
barriers, so let's use them.

include/haproxy/atomic.h

index 5f5a06601d69e3e5218c3e14e75f6eedaa32c7f4..36e02460371e8f9f1a991a5f6a7844fbc9deafd4 100644 (file)
@@ -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 */