Understanding std::counting_semaphore and std::binary_semaphore from C++20
Summary
Explains std::counting_semaphore and std::binary_semaphore in C++20, including how to limit concurrency and send simple thread signals. It also covers timed waits, an RAII guard, and practical pitfalls such as lifetime management and ordering not guaranteed. The article includes code examples and a comparison with mutexes and condition variables.