SObjectizer-5 Extra
Loading...
Searching...
No Matches
so_5::extra::disp::asio_one_thread Namespace Reference

Namespaces

namespace  errors
 
namespace  impl
 

Classes

struct  default_traits_t
 Default traits of asio_one_thread dispatcher. More...
 
class  disp_params_t
 Parameters for asio_one_thread dispatcher. More...
 
class  dispatcher_handle_t
 A handle for asio_one_thread dispatcher. More...
 

Typedefs

using io_context_shptr_t = std::shared_ptr< asio::io_context >
 An alias for shared-pointer to io_context object.
 

Functions

template<typename Traits = default_traits_t>
dispatcher_handle_t make_dispatcher (environment_t &env, const std::string_view data_sources_name_base, disp_params_t params)
 A function for creation an instance of asio_one_thread dispatcher.
 

Typedef Documentation

◆ io_context_shptr_t

using so_5::extra::disp::asio_one_thread::io_context_shptr_t = std::shared_ptr< asio::io_context >

An alias for shared-pointer to io_context object.

Since
v.1.4.1

Definition at line 58 of file pub.hpp.

Function Documentation

◆ make_dispatcher()

template<typename Traits = default_traits_t>
dispatcher_handle_t so_5::extra::disp::asio_one_thread::make_dispatcher ( environment_t & env,
const std::string_view data_sources_name_base,
disp_params_t params )

A function for creation an instance of asio_one_thread dispatcher.

Usage examples:

// Dispatcher which uses own Asio IoContext and default traits.
namespace asio_disp = so_5::extra::disp::asio_one_thread;
asio_disp::disp_params_t params;
params.use_own_io_context(); // Asio IoContext object will be created here.
// This object will be accessible later via
// dispatcher_handle_t::io_context() method.
auto disp = asio_disp::make_dispatcher(
env,
"my_asio_disp",
std::move(disp_params) );
// Dispatcher which uses external Asio IoContext and default traits.
asio::io_context & io_svc = ...;
namespace asio_disp = so_5::extra::disp::asio_one_thread;
asio_disp::disp_params_t params;
params.use_external_io_context( io_svc );
auto disp = asio_disp::make_dispatcher(
env,
"my_asio_disp",
std::move(disp_params) );
Requirements for traits type
The Traits-type is empty in v.1.5.0. There was a possibitily to specify a custom thread type in previous versions of so_5_extra, but since v.1.5.0 custom threads are supported via standard SObjectizer's mechanism based on abstract_work_thread_t/abstract_work_thread_factory_t interfaces. But the Traits-type might be extended by some content in future versions.
Template Parameters
TraitsType with traits for a dispatcher. For the requirements for Traits type see the section "Requirements for traits type" above.
Since
v.1.4.1
Parameters
envSObjectizer environment to work in.
data_sources_name_baseShort name for this instance to be used in thread activity stats. Can be empty string. In this case name will be generated automatically.
paramsParameters for this dispatcher instance.

Definition at line 908 of file pub.hpp.