std::atomic::notify_all(3)

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

πŸ’– std::atomic::notify_all(3) πŸ’–

okay so bestie, this page is from the C++ Standard Libary manual (yes, that spelling is exactly what the original says, not me πŸ’€). it’s giving concurrency, it’s giving C++20, and it’s literally called std::atomic::notify_all.


πŸŽ€ NAME πŸŽ€

std::atomic::notify_all - std::atomic::notify_all β€” yes, the name and the one-liner are the same thing twice, and honestly? iconic. πŸ’…

✨ Synopsis ✨

void notify_all() noexcept;          (1) (since C++20)
void notify_all() volatile noexcept; (2) (since C++20)

so what does it do? it performs atomic notifying operations. that’s the main character move. πŸ‘‘

it unblocks all threads blocked in atomic waiting operations (i.e. wait()) on *this, if there are any; otherwise it does nothing. that’s it. no cap. 🫢

πŸ’– Return value πŸ’–

(none) β€” literally none. nothing. zero. the void is voiding. 😭

πŸ“ Notes πŸ“

this form of change-detection is often more efficient than simple polling or pure spinlocks. periodt. that’s the note, bestie β€” it’s giving efficient, it’s giving not-spinning-forever. ✨

🌸 Example 🌸

This section is incomplete. Reason: no example. 😭 so there’s literally no example here β€” it’s in the todo pile, bestie.

πŸ‘€ See also πŸ‘€

  • wait β€” blocks the thread until notified and the atomic value changes (C++20) (public member function)
  • atomic_wait β€” (C++20)
  • atomic_wait_explicit β€” blocks the thread until notified and the atomic value changes (C++20) (function template)
  • atomic_notify_one β€” notifies a thread blocked in atomic_wait (C++20) (function template)

🏷️ Category 🏷️

  • * Todo no example

signed off from http://cppreference.com on 2024.06.10, page std::atomic::notify_all(3) πŸ’…βœ¨

πŸ“¦ where this page comes from