Thread pool dispatcher.
More...
◆ 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.
|
| 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.
|
◆ default_thread_pool_size()
| std::size_t so_5::disp::thread_pool::default_thread_pool_size |
( |
| ) |
|
|
inline |
A helper function for detecting default thread count for thread pool.
Returns value of std::thread::hardware_concurrency() or 2 if hardware_concurrency() returns 0.
- Since
- v.5.4.0
◆ make_dispatcher() [1/4]
◆ make_dispatcher() [2/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. |
◆ make_dispatcher() [3/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. |
◆ make_dispatcher() [4/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. |