The std::atomic_thread_fence()
function inserts a "memory barrier" or "fence" in the
code to force memory ordering constaints between operations.
std::atomic_thread_fence(std::memory_order order);
- Effects:
-
Insert a fence with the required memory ordering constraints.
A fence with an
orderofstd::memory_order_release,std::memory_order_acq_relorstd::memory_order_seq_cstsynchronizes-with an acquire operation on the some memory location if that acquire operation reads a value stored by an atomic operation following the fence on the same thread as the fence.A release operation synchronizes-with a fence with an
orderofstd::memory_order_acquire,std::memory_order_acq_relorstd::memory_order_seq_cstif that release operation stores a value which is read by an atomic operation prior to the fence on the same thread as the fence. - Throws:
Nothing.
Header
#include <atomic>