std::atomic...:notify_one(3)
β¨ NAME β¨
Okay so bestie, we're in the C++ Standard Libary manual (yes, that's the manual name in the header β I don't make the rules π), and this page is all about:
std::atomic_flag::notify_one β std::atomic_flag::notify_one
Yes, the name is giving "said it twice to make it stick" π . Iconic.
πΈ Synopsis πΈ
Here are the signatures, literally exact, no cap:
void notify_one() noexcept; (1) (since C++20)
void notify_one() volatile noexcept; (2) (since C++20)
Both of these are since C++20 β vintage-ish but still fresh π.
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.
π«Ά Return value π«Ά
(none)
Literally none, bestie. No return value, no extra drama. π
π₯ Notes π₯
This form of change-detection is often more efficient than simple polling or pure spinlocks.
Ngl, that's kind of a slay for performance. π
π Example π
This section is incomplete.
Reason: no example
Not me opening the example section and finding out it's empty π« . It's giving "left on read."
π See also π
waitβ blocks the thread until notified and the atomic value changes. (C++20) (public member function)atomic_flag_waitβ blocks the thread until notified and the flag changes. (C++20) (function)atomic_flag_wait_explicitβ blocks the thread until notified and the flag changes. (C++20) (function)atomic_flag_notify_oneβ notifies a thread blocked inatomic_flag_wait. (C++20) (function)
π·οΈ Category π·οΈ
* Todo no example
Source/version/date tea β: http://cppreference.com Β· 2024.06.10 Β· page std::atomic...:notify_one(3)
Bye bestie β go unblock at least one thread 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