Go to main content
Oracle Developer Studio 12.6 Man Pages

Exit Print View

Updated: June 2017
 
 

atomic_flag (3A)

Name

atomic_flag, atomic_flag_test_and_set, atomic_flag_test_and_set_explicit, atomic_flag_clear, atomic_flag_clear_explicit - atomic_flag test and set functions

Synopsis

cc -std=c11 -xatomic=studio [ flag... ] file... [ library... ]
CC -std=c++11 -xatomic=studio [ flag... ] file... [ library... ]

C synopsis

#include <stdatomic.h>
_Bool atomic_flag_test_and_set(volatile atomic_flag *object);
_Bool atomic_flag_test_and_set_explicit(
    volatile atomic_flag *object, memory_order order);
void atomic_flag_clear(volatile atomic_flag *object);
void atomic_flag_clear_explicit(
    volatile atomic_flag *object, memory_order order);

C++ synopsis

#include <atomic>
namespace std
{
bool atomic_flag_test_and_set(volatile atomic_flag *object) noexcept;
bool atomic_flag_test_and_set(atomic_flag *object) noexcept;
bool atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
    memory_order order) noexcept;
bool atomic_flag_test_and_set_explicit(atomic_flag *object,
    memory_order order) noexcept;
void atomic_flag_clear(volatile atomic_flag *object) noexcept;
void atomic_flag_clear(atomic_flag *object) noexcept;
void atomic_flag_clear_explicit(volatile atomic_flag *object,
     memory_order order) noexcept;
void atomic_flag_clear_explicit(atomic_flag *object,
    memory_order order) noexcept;
}

Description

In the following description, the functions not ending in _explicit have the same semantics as the corresponding _explicit function with memory_order_seq_cst for the memory_order argument.

For atomic_flag_test_and_set() and atomic_flag_clear() functions, memory is affected according to the value of order. Refer to stdatomic.h(3A) for details of memory_order.

The atomic_flag_test_and_set() functions atomically set the value pointed to by object to true, and atomically return the value of the object immediately before the effects.

The atomic_flag_test_and_set() functions are atomic read-modify-write operations. Refer to the C/C++ Standard for the meaning and the effect of atomic read-modify-write operations.

The atomic_flag_clear() function atomically sets the value pointed to by object to false.

The order argument for atomic_flag_clear() will not be memory_order_acquire nor memory_order_acq_rel.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe

See Also

stdatomic.h(3A)