Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 951 Bytes

atomic_flag.adoc

File metadata and controls

44 lines (26 loc) · 951 Bytes

atomic_flag

The atomic_flag type provides the classic test-and-set functionality.

atomic_flag

Description

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.

Example

global atomic_flag guard = ATOMIC_FLAG_INIT;