The atomic_flag type provides the classic test-and-set functionality.
atomic_flag
The atomic_flag
type provides the classic test-and-set functionality.
It has two states, set (value is non-zero) and clear (value is 0).
Operations on an object of type atomic_flag
shall be lock free.
The macro ATOMIC_FLAG_INIT
may be used to initialize an atomic_flag
to the clear state.
An atomic_flag
that is not explicitly initialized with ATOMIC_FLAG_INIT
is initially in an indeterminate state.
This macro can only be used for atomic objects that are declared in program scope in the global address space with the atomic_flag
type.