5 #include <Poco/Mutex.h>
6 #include <Poco/SharedPtr.h>
8 #include "loop/StoppableRunnable.h"
9 #include "loop/StoppableLoop.h"
10 #include "util/Loggable.h"
16 typedef Poco::SharedPtr<LoopRunner> Ptr;
21 void addRunnable(StoppableRunnable::Ptr runnable);
22 void addLoop(StoppableLoop::Ptr loop);
23 void setAutoStart(
bool enable);
30 void start()
override;
42 Stopper(StoppableLoop::Ptr loop);
47 StoppableLoop::Ptr m_loop;
57 void stopAll(std::list<Stopper> &list);
68 Poco::FastMutex m_lock;
69 std::list<StoppableLoop::Ptr> m_loops;
70 std::list<Stopper> m_started;
void setStopParallel(bool parallel)
Set whether stopAll() should run in parallel.
Definition: LoopRunner.cpp:62
void stopAll(std::list< Stopper > &list)
Stop all loop in reverse order. If the property stopParallel is true then the loops are stopped in pa...
Definition: LoopRunner.cpp:83
Wrapper around StoppableLoop that allows to stop it from inside a thread.
Definition: LoopRunner.h:39
Definition: StoppableLoop.h:17
void stopParallel(std::list< Stopper > &list)
Stops the given list of loops in parallel. Loops that have been stopped are removed from the list...
Definition: LoopRunner.cpp:98
void stop() override
Definition: LoopRunner.cpp:67
Definition: LoopRunner.h:14
Definition: Loggable.h:19
void start() override
Definition: LoopRunner.cpp:130