Thread pool dispatcher.
More...
|
| namespace | anonymous_namespace{pub.cpp} |
| |
| namespace | common_implementation |
| | Reusable implementation of some thread pool dispatcher functionality which can be used in other thread-pool-like dispatchers.
|
| |
| namespace | impl |
| | Internal implementation details of thread pool dispatcher.
|
| |
◆ fifo_t
Type of FIFO mechanism for agent's demands.
- Since
- v.5.4.0
| Enumerator |
|---|
| cooperation | A FIFO for demands for all agents from the same cooperation.
It means that agents from the same cooperation for which this FIFO mechanism is used will be worked on the same thread.
If the same disp_binder with fifo_t::cooperation is used for several cooperations then each coop will have a separate event queue (thus agents from different coops may work on different worker threads).
|
| individual | A FIFO for demands only for one agent.
It means that FIFO is only supported for the concrete agent. If several agents from a cooperation have this FIFO type they will process demands independently and on different threads.
|
Definition at line 155 of file thread_pool/pub.hpp.
◆ make_dispatcher() [1/4]
Create an instance thread_pool dispatcher.
- Usage sample
env,
"db_workers_pool",
} ) );
auto coop = env.make_coop(
disp.binder() );
Container for storing parameters for MPSC queue.
queue_params_t & lock_factory(lock_factory_t factory)
Setter for lock factory.
Alias for namespace with traits of event queue.
disp_params_t & thread_count(std::size_t count)
Setter for thread count.
SO_5_FUNC lock_factory_t simple_lock_factory()
Factory for creation of very simple implementation based on usage of mutex and condition_variable onl...
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 thread_pool dispatcher.
- Since
- v.5.6.0
- Parameters
-
| env | SObjectizer Environment to work in. |
| data_sources_name_base | Value for creating names of data sources for run-time monitoring. |
| disp_params | Parameters for the dispatcher. |
- Examples
- so_5/custom_work_thread_factory/main.cpp, so_5/queue_size_stats/main.cpp, and so_5/redirect_and_transform/main.cpp.
Definition at line 243 of file thread_pool/pub.cpp.
◆ make_dispatcher() [2/4]
Create an instance of thread_pool dispatcher with the default count of working threads.
Count of work threads will be detected by default_thread_pool_size() function.
- Usage sample
auto disp = so_5::disp::thread_pool::make_instance( env );
auto coop = env.make_coop(
disp.binder() );
- Since
- v.5.6.0
- Parameters
-
| env | SObjectizer Environment to work in. |
Definition at line 515 of file thread_pool/pub.hpp.
◆ make_dispatcher() [3/4]
Create an instance of thread_pool dispatcher.
- Usage sample
env,
"db_workers_pool",
16 );
auto coop = env.make_coop(
disp.binder() );
- Since
- v.5.6.0
- Parameters
-
| env | SObjectizer Environment to work in. |
| data_sources_name_base | Value for creating names of data sources for run-time monitoring. |
| thread_count | Count of working threads. |
Definition at line 450 of file thread_pool/pub.hpp.
◆ make_dispatcher() [4/4]
Create an instance of thread_pool dispatcher.
- Usage sample
auto coop = env.make_coop(
disp.binder() );
- Since
- v.5.6.0
- Parameters
-
| env | SObjectizer Environment to work in. |
| thread_count | Count of working threads. |
Definition at line 482 of file thread_pool/pub.hpp.