std::atomic...::notify_all(3)
π 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 inatomic_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
- 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