2 #define _SEMAPHORE_HPP 1
5 #include <condition_variable>
9 std::condition_variable
_cv;
16 std::unique_lock<std::mutex> lck(_mtx);
21 std::unique_lock<std::mutex> lck(_mtx);
22 while(_count == 0) _cv.wait(lck);
Semaphore(int count=0)
Definition: Semaphore.hpp:12
std::condition_variable _cv
Definition: Semaphore.hpp:9
Definition: Semaphore.hpp:6
std::mutex _mtx
Definition: Semaphore.hpp:8
void V()
Definition: Semaphore.hpp:15
void P()
Definition: Semaphore.hpp:20
std::atomic< int > _count
Definition: Semaphore.hpp:10