std::latch::count_down(3)
β¨ NAME β¨
okay so welcome to the C++ Standard Libary manual, bestie β this is the page for std::latch::count_down. yes, the name is literally std::latch::count_down, and itβs giving βtiny counter go brrrβ energy. π
πΈ Synopsis πΈ
void count_down( std::ptrdiff_t n = 1 ); (since C++20)
okay so this icon atomically decrements the internal counter by n without blocking the caller. no waiting, no holding up the line, she just does the thing and keeps it moving. β¨
β οΈ bestie, listen: if n is greater than the value of the internal counter or is negative, the behavior is undefined. like π do not do that. undefined behavior is not the vibe.
and this part is important: this operation strongly happens-before all calls that are unblocked on this latch. iykyk β that ordering is the whole point. π₯
π Parameters π
nβ the value by which the internal counter is decreased. thatβs it, thatβs the parameter. π
β Return value β
(none) β literally nothing comes back, sheβs not giving you a return value. π«Ά
π Exceptions π
Throws std::system_error with an error code allowed for mutex types on error. so yeah, if something goes sideways, thatβs the exception situation. periodt. π
source: http://cppreference.com Β· date/version: 2024.06.10 β mwah, go forth and count down responsibly π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms