# Executor.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp/core/async/Executor.hpp"
# Executor
Asynchronous Executor.
Executes coroutines in multiple oatpp::async::Processor allocating one thread per processor.
namespace oatpp { namespace async {
class Executor {}
}}
# Fields
Type | Name | Summary |
---|---|---|
const v_int32 | VALUE_SUGGESTED | Special value to indicate that Executor should choose it's own the value of specified parameter. |
const v_int32 | IO_WORKER_TYPE_NAIVE | IO Worker type naive. |
const v_int32 | IO_WORKER_TYPE_EVENT | IO Worker type event. |
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | Executor | Constructor. |
[none] | ~Executor | Non-virtual Destructor. |
void | join | Join all worker-threads. |
void | detach | Detach all worker-threads. |
void | stop | Stop Executor. |
void | execute | Execute Coroutine. |
v_int32 | getTasksCount | Get number of all not finished tasks. |
void | waitTasksFinished | Wait until all tasks are finished. |
# Executor::VALUE_SUGGESTED
Special value to indicate that Executor should choose it's own the value of specified parameter.
static constexpr const v_int32 VALUE_SUGGESTED = -1000
# Executor::IO_WORKER_TYPE_NAIVE
IO Worker type naive.
static constexpr const v_int32 IO_WORKER_TYPE_NAIVE = 0
# Executor::IO_WORKER_TYPE_EVENT
IO Worker type event.
static constexpr const v_int32 IO_WORKER_TYPE_EVENT = 1
# Executor::Executor
Constructor.
- @param processorWorkersCount - number of data processing workers.
- @param ioWorkersCount - number of I/O processing workers.
- @param timerWorkersCount - number of timer processing workers.
- @param IOWorkerType
Executor(v_int32 processorWorkersCount = VALUE_SUGGESTED,
v_int32 ioWorkersCount = VALUE_SUGGESTED,
v_int32 timerWorkersCount = VALUE_SUGGESTED,
v_int32 ioWorkerType = VALUE_SUGGESTED)
# Executor::~Executor
Non-virtual Destructor.
~Executor() = default
# Executor::join
Join all worker-threads.
void join()
# Executor::detach
Detach all worker-threads.
void detach()
# Executor::stop
Stop Executor.
After all worker-threads are stopped. Join should unblock.
void stop()
# Executor::execute
Execute Coroutine.
- @tparam CoroutineType - type of coroutine to execute.
- @tparam Args - types of arguments to be passed to Coroutine constructor.
- @param params - actual arguments to be passed to Coroutine constructor.
template<typename CoroutineType, typename ... Args>
void execute(Args... params)
# Executor::getTasksCount
Get number of all not finished tasks.
- @return - number of all not finished tasks.
v_int32 getTasksCount()
# Executor::waitTasksFinished
Wait until all tasks are finished.
- @param timeout
void waitTasksFinished(const std::chrono::duration<v_int64, std::micro>& timeout = std::chrono::minutes(1))