std::counti...re::release(3)
β¨ NAME β¨
Okay so bestie, this is std::counting_semaphore::release(3) β header vibe: std::counti...re::release(3) β from the C++ Standard Libary manual (yes, that spelling is literally in the source, not me π).
The name is std::counting_semaphore::release, and the NAME line says std::counting_semaphore::release - std::counting_semaphore::release, because repetition is iconic π
.
πΈ Synopsis πΈ
void release( std::ptrdiff_t update = 1 );
Since: C++20 β¨
This atomically increments the internal counter by the value of update. Any thread(s) waiting for the counter to be greater than 0 β like because theyβre blocked in acquire β will subsequently be unblocked. Slay, wake-up call delivered π«Ά.
π Preconditions π
Both of these need to be true, no cap:
update >= 0update <= max() - counter
β¦where counter is the value of the internal counter. Both conditions are part of the contract, so donβt skip the vibe check π.
π Parameters π
updateβ the amount to increment the internal counter by.
π¦ Exceptions π¦
May throw std::system_error. Not a cute surprise, but there it is π.
π See also π
acquireβ decrements the internal counter or blocks until it can (public member function).try_acquireβ tries to decrement the internal counter without blocking (public member function).try_acquire_forβ tries to decrement the internal counter, blocking for up to a duration time (public member function).try_acquire_untilβ tries to decrement the internal counter, blocking until a point in time (public member function).
mwah π β source/version: http://cppreference.com, dated 2024.06.10. Thatβs the whole page, bestie β go flex those semaphores 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