27 #include "WConditionSet.h"
34 m_notifier( boost::bind( &
WConditionSet::conditionFired, this ) )
41 std::unique_lock<std::shared_mutex> lock = std::unique_lock<std::shared_mutex>(
m_conditionSetLock );
47 ( *it ).second.disconnect();
57 std::unique_lock<std::shared_mutex> lock = std::unique_lock<std::shared_mutex>(
m_conditionSetLock );
72 std::unique_lock<std::shared_mutex> lock = std::unique_lock<std::shared_mutex>(
m_conditionSetLock );
75 ConditionConnectionMap::iterator it =
m_conditionSet.find( condition );
78 ( *it ).second.disconnect();
Class allowing multiple conditions to be used for one waiting cycle.
virtual void wait() const
Wait for the condition.
ConditionConnectionMap m_conditionSet
Set of conditions to be waited for.
bool m_fired
Flag denoting whether one condition fired in the past.
virtual ~WConditionSet()
Destructor.
virtual void reset() const
Resets the internal fire state.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void remove(std::shared_ptr< WCondition > condition)
Removes the specified condition.
bool m_resetable
Flag denoting whether the condition set should act like a one shot condition.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
bool isResetable()
Returns whether the condition set acts like a one shot condition.
WCondition::t_ConditionNotifierType m_notifier
The notifier which gets called by all conditions if they fire.
bool m_autoReset
Flag which shows whether the wait() call should reset the state m_fired when it returns.
virtual void conditionFired()
Notifier function getting notified whenever a condition got fired.
std::shared_mutex m_conditionSetLock
Lock used for thread-safe writing to the condition set.
virtual void notify()
Notifies all waiting threads.
WConditionSet()
Default constructor.
std::pair< std::shared_ptr< WCondition >, boost::signals2::connection > ConditionConnectionPair
Each condition has a connection.
Class to encapsulate boost::condition_variable_any.
virtual void notify()
Notifies all waiting threads.
virtual void wait() const
Wait for the condition.