BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Data Structures | Public Types | Public Member Functions
BeeeOn::ParallelExecutor Class Reference

Implementation of AsyncExecutor interface that invokes given procedures in parallel. More...

#include <ParallelExecutor.h>

Inheritance diagram for BeeeOn::ParallelExecutor:
BeeeOn::AsyncExecutor BeeeOn::StoppableRunnable BeeeOn::HavingThreadPool BeeeOn::Loggable

Public Types

typedef Poco::SharedPtr
< ParallelExecutor
Ptr
 
- Public Types inherited from BeeeOn::AsyncExecutor
typedef Poco::SharedPtr
< AsyncExecutor
Ptr
 
- Public Types inherited from BeeeOn::StoppableRunnable
typedef Poco::SharedPtr
< StoppableRunnable
Ptr
 

Public Member Functions

void setBaseName (const std::string &baseName)
 
void setContentedDelay (const Poco::Timespan &delay)
 
void run () override
 
void stop () override
 
size_t flushDeferred ()
 
void invoke (std::function< void()> f) override
 
- Public Member Functions inherited from BeeeOn::HavingThreadPool
void setMinThreads (int min)
 
void setMaxThreads (int max)
 
void setThreadIdleTime (const Poco::Timespan &time)
 
Poco::ThreadPool & pool ()
 

Additional Inherited Members

- Protected Member Functions inherited from BeeeOn::HavingThreadPool
void initPool ()
 
- Protected Member Functions inherited from BeeeOn::Loggable
void setupLogger (Poco::Logger *logger=0) const
 
Poco::Logger & logger () const
 
 Loggable (const ClassInfo &info)
 
 Loggable (const std::type_info &info)
 
- Static Protected Member Functions inherited from BeeeOn::Loggable
static Poco::Logger & forMethod (const char *name)
 
static Poco::Logger & forClass (const ClassInfo &info)
 
static Poco::Logger & forClass (const std::type_info &info)
 
template<typename T >
static Poco::Logger & forInstance (const T *i)
 
static void configureSimple (Poco::Logger &logger, const std::string &level)
 
static void logException (Poco::Logger &logger, const Poco::Message::Priority priority, const Poco::Exception &e, const char *file, size_t line)
 

Detailed Description

Implementation of AsyncExecutor interface that invokes given procedures in parallel.

ParallelExecutor maintains a thread-pool which is used to allow parallel execution of the procedure invocations requests. If the executor is contented, the requests are enqueued to not loose any of them.

Member Function Documentation

size_t ParallelExecutor::flushDeferred ( )

Get rid of all defered lambda-wrappers. It is called automatically by destructor.

Returns
number of flushed deferred procedures.
void ParallelExecutor::invoke ( std::function< void()>  f)
overridevirtual

Add task to queue for executing

Implements BeeeOn::AsyncExecutor.

void ParallelExecutor::run ( )
override

Executes a loop that invokes deferred procedures.

void ParallelExecutor::stop ( )
overridevirtual

Stops the loop and waits until all threads are stopped.

Implements BeeeOn::StoppableRunnable.


The documentation for this class was generated from the following files: