在下面的代码中
int a = A.load(std::memory_order_acquire);
T b = load_non_atomic(data);
// ---- barrier ----
int c = A.load(std::memory_order_acquire);
Run Code Online (Sandbox Code Playgroud)
即使在弱内存模型架构(例如 ARM)上,load_non_atomic()我应该使用什么样的屏障来避免重新排序?c
直觉上我需要 a来禁止在它之后std::atomic_thread_fence(std::memory_order_release)重新排序读/写操作,但是它是否允许使用释放来加载?