Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/atomic/atomic flag notify all"

From cppreference.com
< cpp‎ | atomic
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 rev begin | since=c++20}}
+
{{dcl|num=1|since=c++20|
{{dcl |  
+
 
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 rev end}}
 
 
{{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 {{lc|std::atomic_flag::wait()}}) on {{c|*object}}, if there are any; otherwise does nothing.
+
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

 
 
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
Safe Reclamation
(C++26)
Hazard Pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11)(deprecated in C++20)
(C++11)(deprecated in C++20)
Memory ordering
Free functions for atomic operations
Free functions for atomic flags
atomic_flag_notify_all
(C++20)
 
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

[edit] See also

notifies at least one thread waiting on the atomic object
(public member function of std::atomic_flag) [edit]
notifies all threads blocked waiting on the atomic object
(public member function of std::atomic_flag) [edit]
blocks the thread until notified and the flag changes
(function) [edit]
notifies a thread blocked in atomic_flag_wait
(function) [edit]