Difference between revisions of "cpp/atomic/atomic notify all"
From cppreference.com
m |
(Splitted the volatile overloads.) |
||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
{{cpp/title|atomic_notify_all}} | {{cpp/title|atomic_notify_all}} | ||
− | {{cpp/ | + | {{cpp/thread/navbar}} |
{{dcl begin}} | {{dcl begin}} | ||
− | {{dcl header | atomic }} | + | {{dcl header|atomic}} |
− | {{dcl | + | {{dcl|num=1|since=c++20| |
− | + | ||
template< class T > | template< class T > | ||
void atomic_notify_all( std::atomic<T>* object ); | void atomic_notify_all( std::atomic<T>* object ); | ||
}} | }} | ||
− | {{dcl | | + | {{dcl|num=2|since=c++20| |
template< class T > | template< class T > | ||
void atomic_notify_all( volatile std::atomic<T>* object ); | void atomic_notify_all( volatile std::atomic<T>* object ); | ||
}} | }} | ||
− | |||
{{dcl end}} | {{dcl end}} | ||
Performs atomic notifying operations. | Performs atomic notifying operations. | ||
− | Unblocks all threads blocked in atomic waiting operations (i.e. {{lc|std::atomic_wait()}}, {{lc|std::atomic_wait_explicit()}}, or {{ | + | Unblocks all threads blocked in atomic waiting operations (i.e. {{lc|std::atomic_wait()}}, {{lc|std::atomic_wait_explicit()}}, or {{l2tf std|cpp/atomic/atomic/wait}}) on {{c|*object}}, if there are any; otherwise does nothing. |
Equivalent to {{c|object->notify_all()}}. | Equivalent to {{c|object->notify_all()}}. | ||
Line 23: | Line 21: | ||
===Parameters=== | ===Parameters=== | ||
{{par begin}} | {{par begin}} | ||
− | {{par | object | pointer to the atomic object to notify}} | + | {{par|object|pointer to the atomic object to notify}} |
{{par end}} | {{par end}} | ||
Line 37: | Line 35: | ||
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/atomic/atomic/dsc notify_one | atomic}} | + | {{dsc inc|cpp/atomic/atomic/dsc notify_one|atomic}} |
− | {{dsc inc | cpp/atomic/atomic/dsc notify_all | atomic}} | + | {{dsc inc|cpp/atomic/atomic/dsc notify_all|atomic}} |
− | {{dsc inc | cpp/atomic/dsc atomic_wait}} | + | {{dsc inc|cpp/atomic/dsc atomic_wait}} |
− | {{dsc inc | cpp/atomic/dsc atomic_notify_one}} | + | {{dsc inc|cpp/atomic/dsc atomic_notify_one}} |
{{dsc end}} | {{dsc end}} | ||
{{langlinks|de|es|fr|it|ja|pt|ru|zh}} | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} |
Latest revision as of 19:02, 24 September 2023
Defined in header <atomic>
|
||
template< class T > void atomic_notify_all( std::atomic<T>* object ); |
(1) | (since C++20) |
template< class T > void atomic_notify_all( volatile std::atomic<T>* object ); |
(2) | (since C++20) |
Performs atomic notifying operations.
Unblocks all threads blocked in atomic waiting operations (i.e. std::atomic_wait(), std::atomic_wait_explicit(), or std::atomic::wait()) on *object, if there are any; otherwise does nothing.
Equivalent to object->notify_all().
Contents |
[edit] Parameters
object | - | pointer to the atomic object to notify |
[edit] Return value
(none)
[edit] Notes
This form of change-detection is often more efficient than simple polling or pure spinlocks.
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
(C++20) |
notifies at least one thread waiting on the atomic object (public member function of std::atomic<T> )
|
(C++20) |
notifies all threads blocked waiting on the atomic object (public member function of std::atomic<T> )
|
(C++20)(C++20) |
blocks the thread until notified and the atomic value changes (function template) |
(C++20) |
notifies a thread blocked in atomic_wait (function template) |