SObjectizer
5.7
|
Reusable components for dispatchers. More...
Namespaces | |
locks | |
Implementation of various types of locks to be used inside dispatchers. | |
thread_pool_stats | |
Helper tools for implementation of run-time monitoring for thread-pool-like dispatchers. | |
work_thread | |
Implemetation details of dispatcher's working thread. | |
Classes | |
class | mpmc_ptr_queue_t |
Multi-producer/Multi-consumer queue of pointers. More... | |
class | work_thread_activity_tracking_flag_mixin_t |
Mixin with thread activity tracking flag. More... | |
class | work_thread_factory_mixin_t |
Mixin that holds optional work thread factory. More... | |
Functions | |
template<typename Params > | |
abstract_work_thread_factory_shptr_t | actual_work_thread_factory_to_use (const work_thread_factory_mixin_t< Params > ¶ms, const environment_t &env) noexcept |
Helper to detect actual work thread factory to be used. More... | |
template<typename Params > | |
work_thread_holder_t | acquire_work_thread (const work_thread_factory_mixin_t< Params > ¶ms, environment_t &env) |
Helper function for acquiring a new worker thread from an appropriate work thread factory. More... | |
so_5::stats::prefix_t | make_disp_prefix (const std::string_view disp_type, const std::string_view data_sources_name_base, const void *disp_this_pointer) |
Create basic prefix for dispatcher data source names. More... | |
so_5::stats::prefix_t | make_disp_working_thread_prefix (const so_5::stats::prefix_t &disp_prefix, std::size_t thread_number) |
Create prefix for dispatcher's working thread data source. More... | |
template<typename Disp_Params_Type > | |
void | modify_disp_params (so_5::environment_t &env, Disp_Params_Type ¶ms) |
Helper functions to adjust some dispatcher parameters with respect to settings from environment. More... | |
template<typename Disp_Iface_Type , typename Disp_No_Tracking , typename Disp_With_Tracking , typename Disp_Params_Type , typename... Args> | |
std::unique_ptr< Disp_Iface_Type > | make_actual_dispatcher (outliving_reference_t< environment_t > env, const std::string_view name_base, Disp_Params_Type disp_params, Args &&...args) |
Helper function for creation of dispatcher instance with respect to work thread activity tracking flag. More... | |
Reusable components for dispatchers.
This namespace contains classes and functions which can be reused by various types of dispatchers.
work_thread_holder_t so_5::disp::reuse::acquire_work_thread | ( | const work_thread_factory_mixin_t< Params > & | params, |
environment_t & | env | ||
) |
Helper function for acquiring a new worker thread from an appropriate work thread factory.
If params defines a factory then the factory from params is used for acquiring new work thread. Otherwise the factory from env is used.
|
noexcept |
Helper to detect actual work thread factory to be used.
If params defines a factory then the factory from params is returned. Otherwise, the factory from env is returned.
std::unique_ptr< Disp_Iface_Type > so_5::disp::reuse::make_actual_dispatcher | ( | outliving_reference_t< environment_t > | env, |
const std::string_view | name_base, | ||
Disp_Params_Type | disp_params, | ||
Args &&... | args | ||
) |
Helper function for creation of dispatcher instance with respect to work thread activity tracking flag.
Disp_Iface_Type | a type of interface for actual dispatcher. This type is expected to be a base class for Disp_No_Tracking and Disp_With_Tracking types. |
Disp_No_Tracking | a type of dispatcher for case when thread activity tracking is not used. |
Disp_With_Tracking | a type of dispatcher for case when thread activity tracking is used. |
Disp_Params_Type | a type of dispatcher-specific parameters. |
Args | types of additional arguments for dispatcher's constructor. |
|
inline |
Create basic prefix for dispatcher data source names.
disp_type | Textual marker of dispatcher type (like ot, ao, ag, tp, atp, ...). |
data_sources_name_base | User-supplied optional base for name. Can be empty. |
disp_this_pointer | Pointer to dispatcher instance. Will be used if data_sources_name_base is empty. |
|
inline |
Create prefix for dispatcher's working thread data source.
disp_prefix | Prefix for the dispatcher. |
thread_number | Thread ordinal number. |
void so_5::disp::reuse::modify_disp_params | ( | so_5::environment_t & | env, |
Disp_Params_Type & | params | ||
) |
Helper functions to adjust some dispatcher parameters with respect to settings from environment.
If dispatcher params doesn't have lock-factory specified the lock-factory will be inherited from environment.
Disp_Params_Type | type of struct/class with dispatcher-related parameters. This type should have queue_params() method. |