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 <bvanassche@acm.org>
#ifndef ARCH_H
#define ARCH_H
#ifndef ARCH_H
#define ARCH_H
+#include <stdatomic.h>
+
#include "../lib/types.h"
enum {
#include "../lib/types.h"
enum {
#define ARCH_CPU_CLOCK_WRAPS
#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"
/* IWYU pragma: begin_exports */
#if defined(__i386__)
#include "arch-x86.h"