std::memory_order_release gives an atomic store release semantics: preceding operations become visible to a thread that performs a matching acquire operation. section 5.2.1 section 5.2.2
Release ordering is permitted for these atomic operation categories:
- Store operations, including std::atomic_flag::clear(). section 5.2.1 section 5.2.2
- Read-modify-write operations; it is not permitted for load operations. section 5.2.1
Releasing a spinlock
A spinlock built with std::atomic_flag uses test_and_set(std::memory_order_acquire) to lock and clear(std::memory_order_release) to unlock. section 5.2.2
