4 #ifndef _DDS_CONDITIONEVENT_H_ 5 #define _DDS_CONDITIONEVENT_H_ 9 #include <condition_variable> 27 std::unique_lock<std::mutex> lock(m_mutex);
28 m_condition.wait(lock, [&]() {
return m_bFlag; });
31 template <
class Rep,
class Period>
32 bool waitFor(
const std::chrono::duration<Rep, Period>& _relTime)
34 std::unique_lock<std::mutex> lock(m_mutex);
35 return m_condition.wait_for(lock, _relTime, [&]() {
return m_bFlag; });
38 template <
class Clock,
class Duration>
39 bool waitUntil(
const std::chrono::time_point<Clock, Duration>& _timeoutTime)
41 std::unique_lock<std::mutex> lock(m_mutex);
42 return m_condition.wait_until(lock, _timeoutTime, [&]() {
return m_bFlag; });
48 std::lock_guard<std::mutex> lock(m_mutex);
51 m_condition.notify_all();
57 std::lock_guard<std::mutex> lock(m_mutex);
60 m_condition.notify_one();
65 std::lock_guard<std::mutex> lock(m_mutex);
72 std::condition_variable m_condition;
void notifyAll()
Definition: ConditionEvent.h:45
bool waitUntil(const std::chrono::time_point< Clock, Duration > &_timeoutTime)
Definition: ConditionEvent.h:39
void reset()
Definition: ConditionEvent.h:63
Helper class for conditional events.
Definition: ConditionEvent.h:17
void wait()
Definition: ConditionEvent.h:25
bool waitFor(const std::chrono::duration< Rep, Period > &_relTime)
Definition: ConditionEvent.h:32
void notifyOne()
Definition: ConditionEvent.h:54
CConditionEvent()
Definition: ConditionEvent.h:20
Definition: BoostHelper.h:14