std::atomic...is_lock_free(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… 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 πŸ’–

  • true if the atomic operations on this object are lock-free.
  • false otherwise.

πŸ¦‹ 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. 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_free indicates 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