Search⌘ K
AI Features

std::latch

Explore how std::latch supports thread synchronization in C++20 by managing atomic counters and blocking calls. Understand its key member functions like count_down, wait, try_wait, and arrive_and_wait through practical examples demonstrating boss-workers workflows and self-coordinating threads.

We'll cover the following...

Now, let us have a closer look at the interface of a std::latch.

Member function Description
lat.count_down(upd = 1) Atomically decrements the counter by upd without blocking the caller.
lat.try_wait() Returns true if counter == 0.
...