Daily bit(e) of C++ | std::counting_semaphore
Daily bit(e) of C++ #442, The C++20 synchronization primitive for limiting concurrent access to a resource: std::counting_semaphore.
The C++20 std::counting_semaphore is a synchronization primitive that can limit the number of concurrent threads accessing a shared resource.
The typical use cases overlap with std::condition_variable; however, std::counting_semaphore offers a more straightforward interface and potentially better performance.