11 #include <so_5_extra/error_ranges.hpp> 13 #include <so_5/disp_binder.hpp> 14 #include <so_5/send_functions.hpp> 16 #include <so_5/disp/reuse/actual_work_thread_factory_to_use.hpp> 17 #include <so_5/disp/reuse/work_thread_activity_tracking.hpp> 18 #include <so_5/disp/reuse/data_source_prefix_helpers.hpp> 19 #include <so_5/disp/reuse/work_thread_factory_params.hpp> 21 #include <so_5/stats/repository.hpp> 22 #include <so_5/stats/messages.hpp> 23 #include <so_5/stats/std_names.hpp> 24 #include <so_5/stats/impl/activity_tracking.hpp> 26 #include <so_5/details/invoke_noexcept_code.hpp> 27 #include <so_5/details/rollback_on_exception.hpp> 28 #include <so_5/details/abort_on_fatal_error.hpp> 30 #include <so_5/impl/thread_join_stuff.hpp> 32 #include <so_5/outliving.hpp> 34 #include <asio/io_context.hpp> 35 #include <asio/post.hpp> 93 swap( a.m_io_context, b.m_io_context );
114 ::asio::io_context & service )
116 m_io_context = std::shared_ptr< ::asio::io_context >(
117 std::addressof( service ),
119 [](::asio::io_context *) {} );
131 std::shared_ptr< ::asio::io_context > service )
133 m_io_context = std::move(service);
147 m_io_context = std::make_shared< ::asio::io_context >();
217 impl::actual_disp_binder_shptr_t binder )
noexcept 224 empty()
const noexcept {
return !m_binder; }
265 return m_binder->io_context();
279 reset()
noexcept { m_binder.reset(); }
322 io_context_shptr_t io_context,
323 ::so_5::disp::work_thread_holder_t thread_holder )
330 io_context()
const noexcept {
return *(
this->m_io_context); }
351 io_context_shptr_t io_context,
352 ::so_5::disp::work_thread_holder_t thread_holder )
357 using base_type_t::io_context;
359 using base_type_t::demands_counter;
387 io_context_shptr_t io_context,
388 ::so_5::disp::work_thread_holder_t thread_holder )
393 using base_type_t::io_context;
395 using base_type_t::demands_counter;
401 so_5::stats::work_thread_activity_stats_t result;
403 result.m_working_stats = m_working_stats.take_stats();
439 template<
typename Work_Thread >
444 using base_type_t = Work_Thread;
457 io_context_shptr_t io_context,
458 ::so_5::disp::work_thread_holder_t thread_holder )
469 [
this]() {
body(); } );
493 push( execution_demand_t demand )
override 532 log_stream <<
"An exception caught in work thread " 533 "of so_5::extra::disp::asio_one_thread dispatcher." 543 log_stream <<
"An unknown exception caught in work thread " 544 "of so_5::extra::disp::asio_one_thread dispatcher." 568 using work_thread_no_activity_tracking_t =
576 work_thread_no_activity_tracking_t & )
584 using work_thread_with_activity_tracking_t =
589 send_thread_activity_stats(
590 const so_5::mbox_t & mbox,
591 const so_5::stats::prefix_t & prefix,
592 work_thread_with_activity_tracking_t & wt )
594 so_5::send< so_5::stats::messages::work_thread_activity >(
597 so_5::stats::suffixes::work_thread_activity(),
599 wt.take_activity_stats() );
613 template<
typename Work_Thread >
616 friend class disp_data_source_t;
620 outliving_reference_t< environment_t > env,
621 const std::string_view name_base,
661 agent_t & agent )
noexcept override 699 const std::string_view name_base,
700 outliving_reference_t< dispatcher_template_t > disp )
759 make( actual_disp_binder_shptr_t binder )
noexcept 761 return { std::move( binder ) };
779 typename... Thread_Init_Args >
787 const std::string_view data_sources_name_base,
791 Thread_Init_Args && ...thread_init_args )
799 "io_context is not set in disp_params" );
898 const std::string_view data_sources_name_base,
dispatcher_handle_t(impl::actual_disp_binder_shptr_t binder) noexcept
Ranges for error codes of each submodules.
dispatcher_handle_t() noexcept=default
A factory class for creation of dispatcher_handle instances.
A handle for asio_one_thread dispatcher.
bool operator!() const noexcept
Does this handle contain a reference to dispatcher?
::asio::io_context & io_context() noexcept
Get reference to io_context from that dispatcher.
operator bool() const noexcept
Is this handle empty?
disp_binder_shptr_t binder() const
Get a binder for that dispatcher.
static dispatcher_handle_t make(actual_disp_binder_shptr_t binder) noexcept
bool empty() const noexcept
Is this handle empty?
void reset() noexcept
Drop the content of handle.
impl::actual_disp_binder_shptr_t m_binder
A reference to actual implementation of a dispatcher.