std::counti...ng_semaphore(3)

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

πŸ’… 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:

  1. Constructs an object of type std::counting_semaphore with the internal counter initialized to desired. ✨
  2. 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:

  1. Both desired >= 0 and desired <= max() are true. Like, both of them. At the same time. Non-negotiable πŸ‘‘

🌸 PARAMETERS

  • desired β€” the value to initialize counting_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