Initialize an atomic object (C11)
Synopsis:
#include <stdatomic.h>
void atomic_init( volatile A* obj,
C desired );
Arguments:
- obj
- A pointer to the atomic object (see the
atomic_* types)
that you want to initialize.
- desired
- The value for the object.
The C represents the non-atomic data type that corresponds to the atomic object.
Library:
- If the atomic function is lock-free (see
atomic_is_lock_free()),
no extra library is required.
- If the function isn't lock-free, you need to link against libatomic.
Use the -l atomic option to
qcc
to link against this library.
Description:
The atomic_init() function is a generic function that initializes the value of
an atomic object.
This function isn't atomic.
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.