Daily bit(e) of C++ | std::binary_semaphore
Daily bit(e) of C++ #232, The C++20 synchronization primitive: std::binary_semaphore.
The C++20 std::binary_semaphore is a specialization of the more general std::counting_semaphore that only supports two values, 0 and 1.
The main use case of a binary semaphore is for simple signalling, where the alternative approach would be to use the combination of std::mutex, std::condition_variable and a boolean variable.