23 #ifndef _SEMAPHORE_HPP_ 24 #define _SEMAPHORE_HPP_ 26 #include <condition_variable> 60 std::unique_lock<std::mutex> ulock (m_mutex);
63 m_cond_var.notify_all ();
66 void wait (
const T &required_value)
68 if (value == required_value)
73 std::unique_lock<std::mutex> ulock (m_mutex);
74 m_cond_var.wait (ulock, [
this, required_value] {
return value == required_value;});
97 m_semaphore.
signal (
false);
102 m_semaphore.
wait (
true);
108 #endif // _SEMAPHORE_HPP_
semaphore< bool > m_semaphore
semaphore(const T &init_value)
void signal(const T &new_value)
void wait(const T &required_value)
std::condition_variable m_cond_var