cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::executors::IAsyncExecutor Class Referenceabstract

Interface of executors to process asynchronous tasks and the processing can be started asynchronously. More...

#include <msgpack_rpc/executors/i_async_executor.h>

Inheritance diagram for msgpack_rpc::executors::IAsyncExecutor:
Collaboration diagram for msgpack_rpc::executors::IAsyncExecutor:

Public Member Functions

 IAsyncExecutor (const IAsyncExecutor &)=delete
 IAsyncExecutor (IAsyncExecutor &&)=delete
 ~IAsyncExecutor () noexcept override=default
 Destructor.
virtual bool is_running ()=0
 Check whether this executor is running.
virtual std::exception_ptr last_exception ()=0
 Get the last exception thrown in asynchronous tasks.
virtual void on_exception (std::function< void(std::exception_ptr)> exception_callback)=0
 Register a function called when an exception is thrown in asynchronous tasks.
IAsyncExecutoroperator= (const IAsyncExecutor &)=delete
IAsyncExecutoroperator= (IAsyncExecutor &&)=delete
virtual void start ()=0
 Start internal event loops to process asynchronous tasks.
virtual void stop ()=0
 Stops operation.
Public Member Functions inherited from msgpack_rpc::executors::IExecutor
 IExecutor (const IExecutor &)=delete
 IExecutor (IExecutor &&)=delete
virtual ~IExecutor () noexcept=default
 Destructor.
virtual AsioContextTypecontext (OperationType type) noexcept=0
 Get the context in asio library.
IExecutoroperator= (const IExecutor &)=delete
IExecutoroperator= (IExecutor &&)=delete

Protected Member Functions

 IAsyncExecutor () noexcept=default
 Constructor.
Protected Member Functions inherited from msgpack_rpc::executors::IExecutor
 IExecutor () noexcept=default
 Constructor.

Detailed Description

Interface of executors to process asynchronous tasks and the processing can be started asynchronously.

Definition at line 37 of file i_async_executor.h.

Member Function Documentation

◆ is_running()

virtual bool msgpack_rpc::executors::IAsyncExecutor::is_running ( )
nodiscardpure virtual

Check whether this executor is running.

Return values
trueThis executor is running.
falseThis executor is not running.

Implemented in msgpack_rpc::executors::GeneralExecutor, and msgpack_rpc::executors::WrappingExecutor.

◆ last_exception()

virtual std::exception_ptr msgpack_rpc::executors::IAsyncExecutor::last_exception ( )
nodiscardpure virtual

Get the last exception thrown in asynchronous tasks.

Returns
Pointer of the exception.

Implemented in msgpack_rpc::executors::GeneralExecutor, and msgpack_rpc::executors::WrappingExecutor.

◆ on_exception()

virtual void msgpack_rpc::executors::IAsyncExecutor::on_exception ( std::function< void(std::exception_ptr)> exception_callback)
pure virtual

Register a function called when an exception is thrown in asynchronous tasks.

Parameters
[in]exception_callbackFunction called when an exception is thrown in asynchronous tasks. The pointer of the exception is passed as an argument.

Implemented in msgpack_rpc::executors::GeneralExecutor, and msgpack_rpc::executors::WrappingExecutor.

◆ start()

virtual void msgpack_rpc::executors::IAsyncExecutor::start ( )
pure virtual

Start internal event loops to process asynchronous tasks.

Note
Internal processing stops
  • when a task throws an exception, which can be retrieved from last_exception function,
  • when stop function is called.

Implemented in msgpack_rpc::executors::GeneralExecutor, and msgpack_rpc::executors::WrappingExecutor.

◆ stop()

virtual void msgpack_rpc::executors::IAsyncExecutor::stop ( )
pure virtual

Stops operation.

Warning
This function stops internal threads. Do not call this function from callbacks called in this executor.

Implemented in msgpack_rpc::executors::GeneralExecutor, and msgpack_rpc::executors::WrappingExecutor.


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