Atomics

Yes!

While atomicMemoryFence itself isn't an atomic operation, it does synchronize memory access and requires an additional atomic operation to set up. I do feel naming this function to something familiar (std::atomic_thread_fence) would be benefit those adopting atomics in Swift. Although to be fair, Rust does just call this fence (fence in std::sync::atomic - Rust) given that not a lot of terminology uses the word fence. We probably would use memoryFence as you mentioned instead of fence though if others think the atomic prefix isn't necessary for this operation.

5 Likes