std::atomic...::notify_all(3)

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

πŸ’… NAME πŸ’…

std::atomic_ref::notify_all β€” bestie, it's literally std::atomic_ref::notify_all, that's the whole name, we're not doing a whole bit here πŸ’–

Ok so this is a page from the C++ Standard Libary manual (yes that's how the manual spells it, I'm not gonna fix their typo, that's their business 🫢), and it's giving ✨*atomic notifying*✨ energy. Let's get into it.


✨ Synopsis ✨

Here's the two overloads, dead exact, no notes:

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

Both of these babies are since C++20 β€” so if your compiler is giving you grief, check your standard flag first, bestie, I'm just saying πŸ™ˆ

They perform atomic notifying operations. That's the vibe.


🌸 DESCRIPTION 🌸

Okay so what does it do? It unblocks all threads that are blocked in atomic waiting operations (i.e. wait()) on *this β€” if there are any. And if there aren't any? It does nothing. Just vibes. Chin up, queen, no crash, no drama πŸ’…


πŸŽ€ RETURN VALUE πŸŽ€

(none)

Literally nothing. It returns void energy. It ate and left no crumbs, no return value, periodt πŸ‘‘


πŸ¦‹ NOTES πŸ¦‹

This form of change-detection is often more efficient than simple polling or pure spinlocks. So like... it's the main character of change-detection, fr fr. Stop spinning, start notifying ✨


πŸ’€ EXAMPLE πŸ’€

This section is incomplete Reason: no example

Yeah. No example. The TODO is real, bestie 😭 If you want one you're gonna have to write it yourself, I don't make the rules.


πŸ”₯ SEE ALSO πŸ”₯

  • wait β€” blocks the thread until notified and the atomic value changes Β· (public member function)
  • atomic_wait, 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)

So wait is the one doing the blocking, and this whole family is the notification squad β€” they're a package deal, iykyk 🧚


⭐ CATEGORY ⭐

  • * Todo no example

(Yeah, still no example. We know. We've accepted it. 🌈)


Mwah πŸ’œ that's the page! Sourced from http://cppreference.com, version 2024.06.10, dated 2024.06.10 β€” so it's a little vintage, like a fine aged manual page πŸ“ Go notify some threads, bestie, you've got this 🫢✨

πŸ“¦ where this page comes from