SObjectizer-5 Extra
Namespaces | Classes | Typedefs | Functions
so_5::extra::disp::asio_one_thread Namespace Reference

Namespaces

 errors
 
 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. More...
 

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. More...
 

Typedef Documentation

◆ io_context_shptr_t

using so_5::extra::disp::asio_one_thread::io_context_shptr_t = typedef 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.
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 );
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.
Examples:
async_op/time_limited/simple/main.cpp, async_op/time_unlimited/simple/main.cpp, disp/asio_one_thread/custom_pthread/main.cpp, disp/asio_one_thread/ping_pong/main.cpp, disp/asio_one_thread/resolve_n/main.cpp, disp/asio_thread_pool/custom_pthread_thread/main.cpp, disp/asio_thread_pool/hello_world/main.cpp, mboxes/collecting_mbox/advanced/main.cpp, mboxes/collecting_mbox/simple/main.cpp, mboxes/composite/simple/main.cpp, mboxes/inflight_limit/simple/main.cpp, mboxes/round_robin/advanced/main.cpp, and sync/simple/main.cpp.

Definition at line 893 of file pub.hpp.