atomic_flag_clear(), atomic_flag_clear_explicit()

Updated: May 06, 2022

Atomically clear a flag (C11)

Synopsis:

#include <stdatomic.h>

void atomic_flag_clear( volatile atomic_flag *obj );

void atomic_flag_clear_explicit( volatile atomic_flag *obj,
                                 memory_order order );

Arguments:

obj
A pointer to the atomic flag that you want to clear.
order
(atomic_flag_clear_explicit() only) The memory_order to use for the operation.

Library:

Description:

The atomic_flag_clear() and atomic_flag_clear_explicit() functions atomically clear the given atomic flag. The atomic_flag_clear() function orders memory access according to memory_order_seq_cst; atomic_flag_clear_explicit() orders them as specified by order.

The implementation of atomic functions may depend on the architecture. For more information, see LL/SC vs LSE atomic operations in the description in Building Embedded Systems of the cpuinfo area of the system page.

Classification:

C11

Safety:  
Cancellation point No
Interrupt handler Read the Caveats
Signal handler Read the Caveats
Thread Yes

Caveats:

If this function is lock-free (see atomic_is_lock_free()), it's safe to call it from an ISR or signal handler.