std::atomic::notify_one(3)
π std::atomic::notify_one(3) π
okay so this is the std::atomic::notify_one(3) page from the C++ Standard Libary manual β yes, Libary is literally the manual name here, no cap. We're doing C++20 atomic notify-one vibes, and every single detail is staying. periodt. π
πΈ NAME πΈ
std::atomic::notify_one-std::atomic::notify_one
β¨ Synopsis β¨
okay so there are two overloads, both noexcept, both since C++20:
void notify_one() noexcept; (1) (since C++20)
void notify_one() volatile noexcept; (2) (since C++20)
Performs atomic notifying operations. If there is a thread blocked in atomic waiting operation (i.e. wait()) on *this, then unblocks at least one such thread; otherwise does nothing. That's the whole move, bestie. β¨
π Return value π
(none)β literally nothing comes back. The return value is(none), and that's iconic. π
π§ Notes π§
This form of change-detection is often more efficient than simple polling or pure spinlocks. That's the note, and honestly slay for efficiency. π₯
π₯Ί Example π₯Ί
Not me checking the example section and it's literally:
This section is incompleteReason: no example
π no example yet, bestie. We move. π«Ά
π See also π
the page lists these exactly, including the standalone (C++20) line, so don't come for me:
waitβ blocks the thread until notified and the atomic value changes.(C++20)β(public member function)atomic_waitatomic_wait_explicitβ blocks the thread until notified and the atomic value changes.(C++20)β(function template)(C++20)atomic_notify_oneβ notifies a thread blocked inatomic_wait.(C++20)β(function template)
π Category π
* Todo no example
source/version + date sign-off: http://cppreference.com Β· 2024.06.10 Β· std::atomic::notify_one(3) β okay bye bestie, go be the notify_one you are and slay π
π
π¦ 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