NebulaStream  0.6.213
NebulaStream is a data and application management framework for the internet of things
NES::Runtime::AsyncTaskExecutor Class Reference

This is a multi-threaded task executor that execute asynchronously tasks. Submitted task are paired to a future value that can be retrieved when the async task is executed. More...

#include <AsyncTaskExecutor.hpp>

Classes

class  AsyncTaskFuture
 This is a future that the async executor returns, which can be retrieved using .wait() More...
 

Public Member Functions

 AsyncTaskExecutor (const HardwareManagerPtr &hardwareMananger, uint32_t numOfThreads=1)
 Creates an AsyncTaskExecutor using numOfThreads threads. More...
 
 ~AsyncTaskExecutor ()
 destructor to clean up inner resources More...
 
bool destroy ()
 Method to clean up the internal resources (called by the destructor). Only the first invocation cleans inner resources. Subsequent calls won't produced any effect. More...
 
template<class Function , class... Args>
AsyncTaskFuture< std::invoke_result_t< std::decay_t< Function >, std::decay_t< Args >... > > runAsync (Function &&f, Args &&... args)
 Submits an async task to the executor to be executed in the future. More...
 

Detailed Description

This is a multi-threaded task executor that execute asynchronously tasks. Submitted task are paired to a future value that can be retrieved when the async task is executed.

Constructor & Destructor Documentation

◆ AsyncTaskExecutor()

NES::Runtime::AsyncTaskExecutor::AsyncTaskExecutor ( const HardwareManagerPtr hardwareMananger,
uint32_t  numOfThreads = 1 
)
explicit

Creates an AsyncTaskExecutor using numOfThreads threads.

Parameters
numOfThreadsthe number of threads to use for the executor

References NES_ASSERT, and NES::setThreadName().

Here is the call graph for this function:

◆ ~AsyncTaskExecutor()

NES::Runtime::AsyncTaskExecutor::~AsyncTaskExecutor ( )

destructor to clean up inner resources

References destroy().

Here is the call graph for this function:

Member Function Documentation

◆ destroy()

bool NES::Runtime::AsyncTaskExecutor::destroy ( )

Method to clean up the internal resources (called by the destructor). Only the first invocation cleans inner resources. Subsequent calls won't produced any effect.

Returns

References NES_ASSERT.

Referenced by ~AsyncTaskExecutor().

Here is the caller graph for this function:

◆ runAsync()

template<class Function , class... Args>
AsyncTaskFuture<std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...> > NES::Runtime::AsyncTaskExecutor::runAsync ( Function &&  f,
Args &&...  args 
)
inline

Submits an async task to the executor to be executed in the future.

Parameters
ffunction to execute
argsits arguments
Returns
a future to the completable future

References backward::details::move(), and NES_ASSERT.

Referenced by NES::Runtime::AsyncTaskExecutor::AsyncTaskFuture< R >::thenAsync().

Here is the call graph for this function:
Here is the caller graph for this function:

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