std::atomic_notify_one(3)
π NAME π
okay so this is std::atomic_notify_one(3) from the C++ Standard Libary manual β yes, thatβs the manual name, typo and all, weβre keeping it π
. The NAME is std::atomic_notify_one - std::atomic_notify_one (the name said βIβm my own twin,β iconic).
β¨ Synopsis β¨
Defined in header <atomic>, and itβs giving two overloads, both since C++20:
template< class T > (1) (since C++20)
void atomic_notify_one( std::atomic<T>* object );
template< class T > (2) (since C++20)
void atomic_notify_one( volatile std::atomic<T>* object );
It performs atomic notifying operations. If there is a thread blocked in atomic waiting operation β thatβs std::atomic_wait(), std::atomic_wait_explicit(), or std::atomic::wait() β on *object, then it unblocks at least one such thread; otherwise it does nothing. Itβs equivalent to object->notify_one(). Slay.
π§ Parameters π§
objectβ pointer to the atomic object to notify. Thatβs the one getting the little wake-up tap π.
π« Return value π«
(none) β it literally returns nothing, bestie, periodt. Itβs too busy being a notifier.
πΈ Notes πΈ
ngl, this form of change-detection is often more efficient than simple polling or pure spinlocks. Lowkey a glow-up over sitting there spinning or polling like a lost cause.
π Example π
This section is incomplete Reason: no example
Thatβs the whole example section, no cap, fr fr. Itβs giving placeholder era, and we respect it π«‘.
π See also π
notify_oneβ notifies at least one thread waiting on the atomic object;(C++20); public member function ofstd::atomic<T>.notify_allβ notifies all threads blocked waiting on the atomic object;(C++20); public member function ofstd::atomic<T>.atomic_notify_allβ notifies all threads blocked inatomic_wait;(C++20); function template.atomic_waitβ(C++20).atomic_wait_explicitβ blocks the thread until notified and the atomic value changes;(C++20); function template.- Also keeping the spare
(C++20)thatβs chillinβ at the end of the source list:(C++20).
π Category π
Todo no example
Source/version: http://cppreference.com β dated 2024.06.10 β page std::atomic_notify_one(3). Stay atomic, bestie π«Άπ
π¦ 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