3 #include <Poco/AtomicCounter.h>
4 #include <Poco/Condition.h>
5 #include <Poco/Mutex.h>
6 #include <Poco/Timespan.h>
57 void wait(
const Poco::Timespan &timeout = -1);
65 bool tryWait(
const Poco::Timespan &timeout = -1);
86 Poco::FastMutex m_lock;
87 Poco::Condition m_condition;
89 Poco::AtomicCounter m_broadcasted;
void broadcast()
Broadcast that the condition has been met.
Definition: WaitCondition.cpp:75
bool tryWait(const Poco::Timespan &timeout=-1)
Wait until the condition is broadcasted. Negative timeout would block infinitly (until broadcasted)...
Definition: WaitCondition.cpp:54
~Broadcaster()
It calls broadcast() internally to make sure that the given wait condition has been broadcasted...
Definition: WaitCondition.cpp:14
Broadcaster can be used to ensure that the broadcast is called even in cast when an unexpected except...
Definition: WaitCondition.h:30
void wait(const Poco::Timespan &timeout=-1)
Wait until the condition is broadcasted. Negative timeout would block infinitly (until broadcasted)...
Definition: WaitCondition.cpp:48
long toMilliseconds(const Poco::Timespan &timeout) const
Convert the given timeout into milliseconds. Negative value is converted to -1. Timeout shorter then ...
Definition: WaitCondition.cpp:37
WaitCondition works as a barrier that waits until some condition is met. When the condition is met an...
Definition: WaitCondition.h:19
void broadcast()
Call WaitCondition::broadcast() unless it has already been called.
Definition: WaitCondition.cpp:19
bool doWait(long ms)
The actual waiting logic.
Definition: WaitCondition.cpp:59