atomicMemoryFence(ordering:)
Establishes a memory ordering without associating it with a particular atomic operation.
Declaration
func atomicMemoryFence(ordering: AtomicUpdateOrdering)Discussion
A relaxed fence has no effect.
An acquiring fence ties to any preceding atomic operation that reads a value, and synchronizes with any releasing operation whose value was read.
A releasing fence ties to any subsequent atomic operation that modifies a value, and synchronizes with any acquiring operation that reads the result.
An acquiring and releasing fence is a combination of an acquiring and a releasing fence.
A sequentially consistent fence behaves like an acquiring and releasing fence, and ensures that the fence itself is part of the single, total ordering for all sequentially consistent operations.
This operation corresponds to std::atomic_thread_fence in C++.
Be aware that Thread Sanitizer does not support fences and may report false-positive races for data protected by a fence.