std::counti...ng_semaphore(3)
π NAME
std::counting_semaphore::counting_semaphore β bestie, it's literally the constructor for std::counting_semaphore. That's it, that's the whole vibe.
Oh and hi, welcome to the C++ Standard Libary section 3 club π«Ά β this page lives there, so you know it's the real deal.
β¨ SYNOPSIS
Ok so here's the actual tea, copied exactly, no cap:
constexpr explicit counting_semaphore( std::ptrdiff_t desired ); (1)
(since C++20)
counting_semaphore( const counting_semaphore& ) = delete; (2)
(since C++20)
What each one is giving:
- Constructs an object of type
std::counting_semaphorewith the internal counter initialized todesired. β¨ - The copy constructor is deleted. Not available. Gone. Periodt π
Both of these are since C++20, so if you're on something older, this whole page is not your era, sorry bb π
π PRECONDITIONS
Before you even think about it, number 1 has rules:
- Both
desired >= 0anddesired <= max()are true. Like, both of them. At the same time. Non-negotiable π
πΈ PARAMETERS
desiredβ the value to initializecounting_semaphore's counter with. That's literally the whole job π―
π¦ EXCEPTIONS
Excuse-free. It throws nothing. Zero drama, zero exceptions, a clean queen π
That's the page bestie, go forth and count your semaphores π
Later, legend β this was served fresh from cppreference.com, dated 2024.06.10, on the std::counti...ng_semaphore(3) page (yes the title is truncated, that's just how it's filed, iykyk). π
π¦ 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