std::atomic...is_lock_free(3)
π std::atomic...is_lock_free(3)
okay bestie, welcome to the std::atomic...is_lock_free(3) page from the C++ Standard Libary manual β yes, that's the manual name as printed, we're keeping it. This is the whole std::atomic_ref::is_lock_free moment, and it's lowkey important.
β¨ NAME β¨
std::atomic_ref::is_lock_freeβstd::atomic_ref::is_lock_free
πΈ Synopsis πΈ
bool is_lock_free() const noexcept; (since C++20)
Checks whether the atomic operations on this object are lock-free.
π Parameters π
- (none) β literally none, bestie, no parameters at all.
π Return value π
trueif the atomic operations on this object are lock-free.falseotherwise.
π¦ Notes π¦
- All atomic types except for
std::atomic_flagmay be implemented using mutexes or other locking operations, rather than using the lock-free atomic CPU instructions. So yeah, that's the vibe: lock-free is not automatically the whole story for every atomic type. - 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. It's giving "same type, different day, different lock situation" π
- 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. Recommend, not require β no cap.
π Example π
This section is incomplete Reason: no example
π See also π
is_always_lock_freeindicates that the type is always lock-free[static]β (public static member constant)
π Category π
- Todo no example
mwah π β source: http://cppreference.com, version/date: 2024.06.10. That's the whole page, bestie π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms