6 #include <Poco/AtomicCounter.h>
7 #include <Poco/AutoPtr.h>
8 #include <Poco/Event.h>
9 #include <Poco/Mutex.h>
10 #include <Poco/RefCountedObject.h>
11 #include <Poco/Timespan.h>
13 #include "loop/StoppableLoop.h"
14 #include "util/AsyncExecutor.h"
15 #include "util/HavingThreadPool.h"
36 typedef Poco::SharedPtr<ParallelExecutor> Ptr;
38 void setBaseName(
const std::string &baseName);
39 void setContentedDelay(
const Poco::Timespan &delay);
59 void invoke(std::function<
void()> f)
override;
66 public Poco::Runnable,
67 public Poco::RefCountedObject,
70 typedef Poco::AutoPtr<ThreadLambda> Ptr;
73 std::function<
void()> f,
75 const std::string &baseName);
77 void start(Poco::ThreadPool &pool);
81 std::function<void()> m_func;
83 std::string m_baseName;
91 void defer(ThreadLambda::Ptr tl);
99 void startOrDefer(ThreadLambda::Ptr tl);
102 std::string m_baseName;
103 Poco::Timespan m_contentedDelay;
104 std::queue<ThreadLambda::Ptr> m_queue;
105 Poco::AtomicCounter m_stop;
106 Poco::FastMutex m_lock;
void invoke(std::function< void()> f) override
Definition: ParallelExecutor.cpp:186
Implementation of AsyncExecutor interface that invokes given procedures in parallel.
Definition: ParallelExecutor.h:28
size_t flushDeferred()
Definition: ParallelExecutor.cpp:166
Definition: HavingThreadPool.h:11
void run() override
Definition: ParallelExecutor.cpp:90
Definition: AsyncExecutor.h:12
Definition: Loggable.h:19
void stop() override
Definition: ParallelExecutor.cpp:136
Definition: StoppableRunnable.h:8