|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <stdatomic.h> | ||
_Bool atomic_is_lock_free(constvolatile A* obj); | (since C11) | |
Determines if the atomic operations on all objects of the typeA (the type of the object pointed to byobj) are lock-free. In any given program execution, the result of callingatomic_is_lock_free is the same for all pointers of the same type.
This is ageneric function defined for allatomic object typesA. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile andvolatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects.
It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like(atomic_is_lock_free)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.
Contents |
| obj | - | pointer to the atomic object to inspect |
true if the operations on all objects of the typeA are lock-free,false otherwise.
Possible output:
_Atomic struct A is lock free? false_Atomic struct B is lock free? true
The following behavior-changing defect reports were applied retroactively to previously published C standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| DR 465 | C11 | this function was per-object | this functions is per-type |
| indicates that the given atomic type is lock-free (macro constant)[edit] | |
C++ documentation foratomic_is_lock_free | |