std::atomic_notify_all(3)
π std::atomic_notify_all β from the C++ Standard Library
okay so bestie, welcome to std::atomic_notify_all π this whole page lives in the C++ Standard Library, and we're about to make waking up threads sound as cute as it actually is (it's lowkey iconic, fr).
β¨ NAME β¨
std::atomic_notify_all β like, literally std::atomic_notify_all. that's the name. that's the vibe. π
πΈ SYNOPSIS πΈ
so it's defined in the header <atomic>, and there are two flavors of this bad boy β both since C++20, no cap:
template< class T > (1) (since C++20)
void atomic_notify_all( std::atomic<T>* object );
template< class T > (2) (since C++20)
void atomic_notify_all( volatile std::atomic<T>* object );
what does it actually do? it performs atomic notifying operations. that's the whole job. π
here's the tea: it unblocks all threads that are blocked in atomic waiting operations β and to be clear, that means std::atomic_wait(), std::atomic_wait_explicit(), or std::atomic::wait() β on *object, if there are any threads chillin' there. if there aren't any? it just does nothing. literally nothing. it's fine, it's giving unbothered. π¦
and hey, it's equivalent to object->notify_all(). same energy, different outfit. β¨
π§ PARAMETERS π§
objectβ pointer to the atomic object to notify. that's the one getting the group-chat ping. π«Ά
π RETURN VALUE π
(none) β nothing. zero. nada. it doesn't return anything, it just does the thing. π
π NOTES π
ngl, this form of change-detection is often more efficient than simple polling or pure spinlocks. so likeβ¦ stop spinlocking, bestie. it's not the moment. π₯
π EXAMPLE π
This section is incomplete Reason: no example
(yeah π no example yet. we're waiting on it. main character energy but the chapter hasn't dropped. β)
π 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_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)
π CATEGORY π
- Todo no example
okay that's the whole page, you ate that π§π
and now the cute little sign-off: this one's from cppreference.com, version 2024.06.10, filed under std::atomic_notify_all(3) β screenshot it, memorize it, live it, periodt. πΈπ
π¦
π¦ 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