std::barrier<CompletionFunction>::arrive_and_drop

From cppreference.com
< cpp‎ | thread‎ | barrier
 
 
Concurrency support library
Threads
(C++11)
(C++20)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11)(deprecated in C++20)
(C++11)(deprecated in C++20)
Free functions for atomic operations
Free functions for atomic flags
Memory ordering
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(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)
 
 
void arrive_and_drop();
(since C++20)

Decrements the initial expected count for all subsequent phases by one, and then decrements the expected count for the current phase by one.

This function is executed atomically. The call to this function strongly happens-before the start of the phase completion step for the current phase.

The behavior is undefined if the expected count for the current phase is zero.

Parameters

(none)

Return value

(none)

Exceptions

Throws std::system_error with an error code allowed for mutex types on error.

Notes

This function can cause the completion step for the current phase to start.

If the current expected count is zero before calling this function, the initial expected count for all subsequent phases is also zero, which means the barrier cannot be reused.

Example