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 THREAD_NUM_DEFAULT Default number of threads to run coroutines.

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.

Executor::THREAD_NUM_DEFAULT

Default number of threads to run coroutines.

static const v_int32 THREAD_NUM_DEFAULT

Executor::Executor

Constructor.

  • @param threadsCount - Number of threads to run coroutines.

Executor(v_int32 threadsCount = THREAD_NUM_DEFAULT)

Executor::~Executor

Non-virtual Destructor.

~Executor()

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)