function
<atomic>

atomic_thread_fence

extern "C" void atomic_thread_fence (memory_order sync) noexcept;
Thread fence
Establishes a multi-thread fence: The point of call to this function becomes either an acquire or a release synchronization point (or both).

All visible side effects from the releasing thread that happen before the call to this function are synchronized to also happen before the call this function in the acquiring thread.

Calling this function has the same effects as a load or store atomic operation, but without involving an atomic value.

Parameters

sync
Synchronization mode for the operation.
This shall be one of these possible values of the enum type memory_order:
valuememory orderdescription
memory_order_relaxedRelaxedThe call has no effects.
memory_order_consumeConsumeSets up an acquire fence:
Synchronizes all visible side effects from the last release or sequentially consistent operation.
memory_order_acquireAcquire
memory_order_releaseReleaseSets up a release fence:
Synchronizes side effects with the next acquire operation.
memory_order_acq_relAcquire/ReleaseSets up a fence that is both an acquire fence and a release fence:
Synchronizes all visible side effects from the last release or sequentially consistent operation and with the next acquire operation.
memory_order_seq_cstSequentially consistentSets up a sequentially consistent acquire and release fence:
Synchronizes all visible side effects with the other sequentially consistent operations, following a single total order.

Return value

none

Data races

No data races are initiated by calling this function.

Exception safety

No-throw guarantee: never throws exceptions.

See also