atomic_is_lock_free()

Updated: April 19, 2023

Determine whether atomic operations on an object are lock-free (C11)

Synopsis:

#include <stdatomic.h>

_Bool atomic_is_lock_free( const volatile A* obj );

Arguments:

obj
A pointer to the atomic object (see the atomic_* types) that you want to check.

Library:

None.

Description:

The atomic_is_lock_free() function is a generic function that determines whether or not atomic operations on the given type of object are lock-free. This depends on your target platform; if the compiler can't generate lock-free instructions for your target, you need to link your program against libatomic.

This function isn't atomic.

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.

Returns:

true if the operations are lock-free, or false otherwise.

Classification:

C11

Safety:  
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes