I am working on a project that depends on GCC's atomic built-ins. While porting the project to Windows, I was trying to find the Interlocked* counterparts for GCC atomics. Most operations are actually available, but I miss operations that apply __ATOMIC_CONSUME
and __ATOMIC_ACQ_REL
memory semantics. As _*Barrier intrinsics are deprecated, Microsoft advises to use std::atomic
(e.g. atomic_thread_fence
) and alike of the C++11 standard.
I was wondering: What is the C programmer supposed to do and how can we implement a portable version of atomics
with __ATOMIC_CONSUME
and __ATOMIC_ACQ_REL
semantics, without using C++11?