2
3
6
7
8
9
10
11
12
16#include <so_5/declspec.hpp>
18#include <so_5/disp_binder.hpp>
20#include <so_5/priority.hpp>
22#include <so_5/disp/mpsc_queue_traits/pub.hpp>
24#include <so_5/disp/reuse/work_thread_activity_tracking.hpp>
25#include <so_5/disp/reuse/work_thread_factory_params.hpp>
38
39
40
41
42
49
50
51
52
53
71 static_cast< activity_tracking_mixin_t & >(a),
72 static_cast< activity_tracking_mixin_t & >(b) );
78 swap( a.m_queue_params, b.m_queue_params );
85 m_queue_params = std::move(p);
91
92
93
94
95
96
97
98
99
100
101
102
103 template<
typename L >
115 return m_queue_params;
135
136
137
138
139
153 empty()
const noexcept {
return !m_binder; }
175 reset()
noexcept { m_binder.reset(); }
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
209 const std::string_view data_sources_name_base,
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
239 const std::string_view data_sources_name_base )
241 return make_dispatcher( env, data_sources_name_base, disp_params_t{} );
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
267 return make_dispatcher( env, std::string_view{} );
Container for storing parameters for MPSC queue.
Alias for namespace with traits of event queue.
queue_traits::queue_params_t m_queue_params
Queue parameters.
disp_params_t & set_queue_params(queue_traits::queue_params_t p)
Setter for queue parameters.
disp_params_t()=default
Default constructor.
const queue_traits::queue_params_t & queue_params() const
Getter for queue parameters.
disp_params_t & tune_queue_params(L tunner)
Tuner for queue parameters.
friend void swap(disp_params_t &a, disp_params_t &b) noexcept
A handle for prio_dedicated_threads::one_per_prio dispatcher.
dispatcher_handle_t() noexcept=default
void reset() noexcept
Drop the content of handle.
bool operator!() const noexcept
Does this handle contain a reference to dispatcher?
disp_binder_shptr_t m_binder
Binder for the dispatcher.
operator bool() const noexcept
Is this handle empty?
dispatcher_handle_t(disp_binder_shptr_t binder) noexcept
bool empty() const noexcept
Is this handle empty?
disp_binder_shptr_t binder() const noexcept
Get a binder for that dispatcher.
static dispatcher_handle_t make(disp_binder_shptr_t binder) noexcept
stats::prefix_t m_base_prefix
Basic prefix for data sources.
void distribute(const mbox_t &mbox) override
Send appropriate notification about the current value.
outliving_reference_t< dispatcher_template_t > m_dispatcher
Dispatcher to work with.
disp_data_source_t(const std::string_view name_base, outliving_reference_t< dispatcher_template_t > disp)
void distribute_value_for_work_thread(const mbox_t &mbox, priority_t priority, std::size_t agents_count, Work_Thread &wt)
void launch_work_threads()
Start all working threads.
stats::auto_registered_source_holder_t< disp_data_source_t > m_data_source
Data source for run-time monitoring.
std::vector< std::unique_ptr< Work_Thread > > m_threads
Working threads for every priority.
dispatcher_template_t(outliving_reference_t< environment_t > env, const std::string_view name_base, disp_params_t params)
void allocate_work_threads(environment_t &env, const disp_params_t ¶ms)
Allocate work threads for dispatcher.
void undo_preallocation(agent_t &) noexcept override
Undo resources allocation.
void bind(agent_t &agent) noexcept override
Bind agent to dispatcher.
void preallocate_resources(agent_t &) override
Allocate resources in dispatcher for new agent.
void unbind(agent_t &agent) noexcept override
Unbind agent from dispatcher.
~dispatcher_template_t() noexcept override
Mixin with thread activity tracking flag.
Mixin that holds optional work thread factory.
Interface for dispatcher binders.
Helper class for indication of long-lived reference via its type.
A holder for data-souce that should be automatically registered and deregistered in registry.
A type for storing prefix of data_source name.
An interface of data source.
void send_thread_activity_stats(const so_5::mbox_t &, const stats::prefix_t &, work_thread::work_thread_no_activity_tracking_t &)
void send_thread_activity_stats(const so_5::mbox_t &mbox, const stats::prefix_t &prefix, work_thread::work_thread_with_activity_tracking_t &wt)
Various stuff related to MPSC event queue implementation and tuning.
Implementation details for dispatcher with one thread per priority.
Dispatcher which creates exactly one thread per priority.
dispatcher_handle_t make_dispatcher(environment_t &env, const std::string_view data_sources_name_base)
Create an instance of one_per_prio dispatcher.
SO_5_FUNC dispatcher_handle_t make_dispatcher(environment_t &env, const std::string_view data_sources_name_base, disp_params_t params)
Create an instance of one_per_prio dispatcher.
dispatcher_handle_t make_dispatcher(environment_t &env)
Create an instance of one_per_prio dispatcher.
Dispatchers with dedicated threads for every priority.
Implemetation details of dispatcher's working thread.
Reusable components for dispatchers.
All stuff related to run-time monitoring and statistics.
Private part of message limit implementation.
priority_t
Definition of supported priorities.