Difference between revisions of "cpp/atomic/atomic flag notify all"
From cppreference.com
m |
(Splitted the volatile overloads.) |
||
Line 2: | Line 2: | ||
{{cpp/thread/navbar}} | {{cpp/thread/navbar}} | ||
{{dcl begin}} | {{dcl begin}} | ||
− | {{dcl header | atomic }} | + | {{dcl header|atomic}} |
− | {{dcl | + | {{dcl|num=1|since=c++20| |
− | + | ||
void atomic_flag_notify_all( std::atomic_flag* object ) noexcept; | void atomic_flag_notify_all( std::atomic_flag* object ) noexcept; | ||
}} | }} | ||
− | {{dcl | | + | {{dcl|num=2|since=c++20| |
void atomic_flag_notify_all( volatile std::atomic_flag* object ) noexcept; | void atomic_flag_notify_all( volatile std::atomic_flag* object ) noexcept; | ||
}} | }} | ||
− | |||
{{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_flag_wait()}}, {{lc|std::atomic_flag_wait_explicit()}}, or {{ | + | Unblocks all threads blocked in atomic waiting operations (i.e. {{lc|std::atomic_flag_wait()}}, {{lc|std::atomic_flag_wait_explicit()}}, or {{l2tf std|cpp/atomic/atomic_flag/wait}}) on {{c|*object}}, if there are any; otherwise does nothing. |
Equivalent to {{c|object->notify_all()}}. | Equivalent to {{c|object->notify_all()}}. | ||
Line 21: | Line 19: | ||
===Parameters=== | ===Parameters=== | ||
{{par begin}} | {{par begin}} | ||
− | {{par | object | pointer to the atomic_flag object to notify}} | + | {{par|object|pointer to the {{tt|atomic_flag}} object to notify}} |
{{par end}} | {{par end}} | ||
Line 35: | Line 33: | ||
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/atomic/atomic/dsc notify_one | atomic_flag}} | + | {{dsc inc|cpp/atomic/atomic/dsc notify_one|atomic_flag}} |
− | {{dsc inc | cpp/atomic/atomic/dsc notify_all | atomic_flag}} | + | {{dsc inc|cpp/atomic/atomic/dsc notify_all|atomic_flag}} |
− | {{dsc inc | cpp/atomic/dsc atomic_flag_wait}} | + | {{dsc inc|cpp/atomic/dsc atomic_flag_wait}} |
− | {{dsc inc | cpp/atomic/dsc atomic_flag_notify_one}} | + | {{dsc inc|cpp/atomic/dsc atomic_flag_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 00:12, 25 September 2023
Defined in header <atomic>
|
||
void atomic_flag_notify_all( std::atomic_flag* object ) noexcept; |
(1) | (since C++20) |
void atomic_flag_notify_all( volatile std::atomic_flag* object ) noexcept; |
(2) | (since C++20) |
Performs atomic notifying operations.
Unblocks all threads blocked in atomic waiting operations (i.e. std::atomic_flag_wait(), std::atomic_flag_wait_explicit(), or std::atomic_flag::wait()) on *object, if there are any; otherwise does nothing.
Equivalent to object->notify_all().
Contents |
[edit] Parameters
object | - | pointer to the atomic_flag 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_flag )
|
(C++20) |
notifies all threads blocked waiting on the atomic object (public member function of std::atomic_flag )
|
(C++20)(C++20) |
blocks the thread until notified and the flag changes (function) |
(C++20) |
notifies a thread blocked in atomic_flag_wait (function) |