3 #include <Poco/Clock.h>
4 #include <Poco/Mutex.h>
5 #include <Poco/RunnableAdapter.h>
6 #include <Poco/SharedPtr.h>
7 #include <Poco/Timespan.h>
8 #include <Poco/Thread.h>
10 #include "util/AsyncWork.h"
11 #include "util/Joiner.h"
12 #include "util/Loggable.h"
13 #include "loop/StopControl.h"
27 typedef Poco::SharedPtr<AbstractSeeker> Ptr;
59 bool tryJoin(
const Poco::Timespan &timeout)
override;
71 Poco::Timespan m_duration;
72 Poco::RunnableAdapter<AbstractSeeker> m_runnable;
73 Poco::Thread m_thread;
74 mutable Poco::FastMutex m_lock;
75 Poco::Clock m_started;
AsyncWork is an interface allowing to wait until an asynchronous operation finishes. It is also possible to force-stop it by calling cancel().
Definition: AsyncWork.h:21
AbstractSeeker represents an asynchronous process that seeks for new devices in a certain network...
Definition: AbstractSeeker.h:25
Joiner implements join() on a thread that can be called multiple times from different threads...
Definition: Joiner.h:21
void cancel() override
Cancel seeking and wait for the thread to finish.
Definition: AbstractSeeker.cpp:67
StopControl implements the stop mechanism generically.
Definition: StopControl.h:12
Poco::Timespan duration() const
Definition: AbstractSeeker.cpp:17
Definition: Loggable.h:19
Poco::Timespan elapsed() const
Definition: AbstractSeeker.cpp:22
void start()
Start the seeking thread.
Definition: AbstractSeeker.cpp:49
Poco::Timespan remaining() const
Compute time that is remaining to finish the seeking process. If the seeking has finished, it returns 0.
Definition: AbstractSeeker.cpp:32
bool tryJoin(const Poco::Timespan &timeout) override
Join the seeking thread via Joiner.
Definition: AbstractSeeker.cpp:62