std::experimental::latch(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so bestie, this is the std::experimental::latch page from the C++ Standard Libary manual, and it’s literally the same name twice: std::experimental::latch β€” std::experimental::latch. iconic, no notes πŸ’…


✨ SYNOPSIS ✨

Defined in header <experimental/latch>:

class latch;                            (concurrency TS)

The latch class is a downward counter of type ptrdiff_t that can be used to synchronize threads. The counter’s value gets initialized on creation. Threads may block on the latch until the counter is decremented all the way to zero. There is no possibility to increase or reset the counter, which makes the latch a single-use barrier. periodt 🫢

Unlike std::experimental::barrier, std::experimental::latch can be decremented by a participating thread more than once. slay for flexibility πŸ”₯


πŸŽ€ MEMBER FUNCTIONS πŸŽ€

  • constructor β€” constructs a latch (public member function) 🧚
  • destructor β€” destroys the latch (public member function) πŸ’€
  • operator= β€” not copy-assignable; it’s marked [deleted] (public member function) πŸ™ˆ
  • count_down_and_wait β€” decrements the counter by 1 and blocks until it reaches zero (public member function) ⭐
  • count_down β€” decrements the counter in a non-blocking manner (public member function) 🌈
  • is_ready β€” tests if the internal counter equals zero (public member function) πŸ‘‘
  • wait β€” blocks until the counter reaches zero (public member function) 🌸

mwah πŸ’‹ β€” source: http://cppreference.com, version/date: 2024.06.10, and the page is std::experimental::latch(3). that’s the whole vibe check, bestie πŸ’œ

πŸ“¦ where this page comes from