std::latch:...ive_and_wait(3)

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

πŸ’– NAME πŸ’–

okay so bestie, welcome to the std::latch::arrive_and_wait page from the C++ Standard Libary manual (yes, that spelling is literally in the header β€” iykyk πŸ’…). This is the function std::latch::arrive_and_wait, and the NAME section is just that iconique name twice with a dash between. periodt.

std::latch::arrive_and_wait - std::latch::arrive_and_wait


✨ Synopsis ✨

void arrive_and_wait( std::ptrdiff_t n = 1 );  (since C++20)

Okay so here’s the tea β˜•: it atomically decrements the internal counter by n and, if necessary, blocks the calling thread until the counter reaches zero. Equivalent to:

count_down(n); wait();

If n is greater than the value of the internal counter or is negative, the behavior is undefined 😭 β€” like, do not do that, bestie, fr fr.

πŸŽ€ Parameters πŸŽ€

  • n β€” the value by which the internal counter is decreased

🌸 Return value 🌸

(none) β€” literally nothing, she gives void energy πŸ’…

πŸ¦‹ Exceptions πŸ¦‹

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


cute sign-off: source/version is http://cppreference.com, dated 2024.06.10. mwah πŸ’‹βœ¨
πŸ“¦ where this page comes from