std::experimental::latch
From cppreference.com
< cpp | experimental
Merged into ISO C++ The functionality described on this page was merged into the mainline ISO C++ standard as of 7/2019; see std::latch (since C++20)
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Experimental
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Extensions for concurrency
std::future extensions
Latches and barriers
experimental::latch
Atomic smart pointers
std::experimental::latch
Defined in header
<experimental/latch>
class latch;
(concurrency TS)
The latch
class is a downward counter of type ptrdiff_t
which can be
used to synchronize threads. The value of the counter is initialized on creation.
Threads may block on the latch until the counter is decremented to zero. There is
no possibility to increase or reset the counter, which makes the latch a single-use
barrier.
Unlike std::experimental::barrier, std::experimental::latch
can be decremented by a participating thread more than once.