2
3
4
5
6
7
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>
54
55
56
57
64
65
93 swap( a.m_io_context, b.m_io_context );
98
99
100
101
102
103
104
105
106
107
108
109
110
111
114 ::asio::io_context & service )
116 m_io_context = std::shared_ptr< ::asio::io_context >(
117 std::addressof( service ),
119 [](::asio::io_context *) {} );
125
126
127
128
131 std::shared_ptr< ::asio::io_context > service )
133 m_io_context = std::move(service);
139
140
141
142
143
147 m_io_context = std::make_shared< ::asio::io_context >();
169
170
171
172
173
174
188
189
190
191
204
205
206
207
208
217 impl::actual_disp_binder_shptr_t binder )
noexcept
224 empty()
const noexcept {
return !m_binder; }
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
258
259
260
265 return m_binder->io_context();
279 reset()
noexcept { m_binder.reset(); }
288
289
290
291
292
298
299
300
301
302
313
314
315
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); }
338
339
340
341
342
343
344
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;
370
371
372
373
374
375
376
377
378
379
380
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();
427
428
429
430
431
432
433
434
435
436
437
438
439template<
typename Work_Thread >
444 using base_type_t = Work_Thread;
448
449
450
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
547 log_stream <<
"An exception caught in work thread "
548 "of so_5::extra::disp::asio_one_thread dispatcher."
558 log_stream <<
"An unknown exception caught in work thread "
559 "of so_5::extra::disp::asio_one_thread dispatcher."
583using work_thread_no_activity_tracking_t =
591 work_thread_no_activity_tracking_t & )
599using work_thread_with_activity_tracking_t =
604send_thread_activity_stats(
605 const so_5::mbox_t & mbox,
606 const so_5::stats::prefix_t & prefix,
607 work_thread_with_activity_tracking_t & wt )
609 so_5::send< so_5::stats::messages::work_thread_activity >(
612 so_5::stats::suffixes::work_thread_activity(),
614 wt.take_activity_stats() );
621
622
623
624
625
626
627
628template<
typename Work_Thread >
631 friend class disp_data_source_t;
699
700
701
702
703
765
766
767
768
774 make( actual_disp_binder_shptr_t binder )
noexcept
776 return { std::move( binder ) };
784
785
786
787
788
789
790
791
794 typename... Thread_Init_Args >
802 const std::string_view data_sources_name_base,
806 Thread_Init_Args && ...thread_init_args )
814 "io_context is not set in disp_params" );
847
848
849
850
851
852
853
854
855
856
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
913 const std::string_view data_sources_name_base,
A handle for asio_one_thread dispatcher.
bool operator!() const noexcept
Does this handle contain a reference to dispatcher?
void reset() noexcept
Drop the content of handle.
disp_binder_shptr_t binder() const
Get a binder for that dispatcher.
operator bool() const noexcept
Is this handle empty?
dispatcher_handle_t() noexcept=default
::asio::io_context & io_context() noexcept
Get reference to io_context from that dispatcher.
dispatcher_handle_t(impl::actual_disp_binder_shptr_t binder) noexcept
impl::actual_disp_binder_shptr_t m_binder
A reference to actual implementation of a dispatcher.
bool empty() const noexcept
Is this handle empty?
A factory class for creation of dispatcher_handle instances.
static dispatcher_handle_t make(actual_disp_binder_shptr_t binder) noexcept
Ranges for error codes of each submodules.