From 3932f8be718fc4ca3b863c51c0d567821d75c003 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 21 Jun 2020 14:38:41 -0700 Subject: [PATCH] arch/arch.h: Introduce atomic_{load_acquire,store_release}() Implement atomic_load_acquire() and atomic_store_release() with C11 atomic operations. These two primitives will be used in later patches. This patch increases the minimum requirement for the compiler fio is built with from C90 to C11. Signed-off-by: Bart Van Assche --- arch/arch.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arch.h b/arch/arch.h index 30c0d205..08c3d703 100644 --- a/arch/arch.h +++ b/arch/arch.h @@ -1,6 +1,8 @@ #ifndef ARCH_H #define ARCH_H +#include + #include "../lib/types.h" enum { @@ -34,6 +36,13 @@ extern unsigned long arch_flags; #define ARCH_CPU_CLOCK_WRAPS +#define atomic_load_acquire(p) \ + atomic_load_explicit((_Atomic typeof(*(p)) *)(p), \ + memory_order_acquire) +#define atomic_store_release(p, v) \ + atomic_store_explicit((_Atomic typeof(*(p)) *)(p), (v), \ + memory_order_release) + /* IWYU pragma: begin_exports */ #if defined(__i386__) #include "arch-x86.h" -- 2.25.1