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