Namespaces
Variants
Views
Actions

std::atomic::is_lock_free

From cppreference.com
< cpp‎ | atomic‎ | atomic
 
 
 
 
(since C++11)
bool is_lock_free() const;
bool is_lock_free() const volatile;

Checks whether the atomic operations on all objects of this type are lock-free.

Contents

[edit] Parameters

(none)

[edit] Return value

true if the atomic operations on the objects of this type are lock-free, false otherwise.

[edit] Notes

All atomic types except for std::atomic_flag may be implemented using mutexes or other locking operations, rather than using the lock-free atomic CPU instructions. Atomic types are also allowed to be sometimes lock-free, e.g. if only aligned memory accesses are naturally atomic on a given architecture, misaligned objects of the same type have to use locks.

The C++ standard recommends (but does not require) that lock-free atomic operations are also address-free, that is, suitable for communication between processes using shared memory.

[edit] Exceptions

noexcept specification:  
noexcept
  

[edit] See also

checks if the atomic type's operations are lock-free
(function template) [edit]
[static] (C++17)
indicates that the type is always lock-free
(public static member constant) [edit]