libjmmcg
build_2783
A C++ library containing an eclectic mix of useful, advanced components.
|
This pool has a limited, specified size, and uses a master to distribute the work to the worker threads. More...
#include <thread_pool_master.hpp>
Public Types | |
enum | erase_states { erase_states::failed_to_erase, erase_states::ignoring_result, erase_states::erased_successfully } |
using | base_t = private_::thread_pool_queue_model< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT, private_::fixed_pool_of_threads< PTT, boost::ptr_vector< pool::private_::thread_types::slave< PTT::result_traits_, typename PTT::os_traits, PTT > > > > |
using | pool_traits_type = typename base_t::pool_traits_type |
using | os_traits = typename base_t::os_traits |
using | thread_traits = typename base_t::thread_traits |
using | api_params_type = typename base_t::api_params_type |
using | pool_type = typename base_t::pool_type |
using | statistics_type = typename base_t::statistics_type |
using | work_distribution_mode = typename base_t::work_distribution_mode |
using | signalled_work_queue_type = typename base_t::signalled_work_queue_type |
Public Member Functions | |
__stdcall | thread_pool (const typename pool_traits_type::pool_type::size_type num_threads) noexcept(false) FORCE_INLINE |
Create the thread pool. More... | |
thread_pool (thread_pool const &)=delete | |
__stdcall | ~thread_pool () noexcept(false) FORCE_INLINE |
template<typename ExecT_ > | |
erase_states __fastcall | erase (ExecT_ &ec) |
Erase the specified, queued work. More... | |
const statistics_type __fastcall | statistics () const noexcept(true) FORCE_INLINE |
Obtain access to any statistics data collected by the operation of the thread_pool. More... | |
This pool has a limited, specified size, and uses a master to distribute the work to the worker threads.
Definition at line 308 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::api_params_type = typename base_t::api_params_type |
Definition at line 341 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::base_t = private_::thread_pool_queue_model< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT, private_::fixed_pool_of_threads< PTT, boost::ptr_vector< pool::private_::thread_types::slave< PTT::result_traits_, typename PTT::os_traits, PTT > > > > |
Definition at line 337 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::os_traits = typename base_t::os_traits |
Definition at line 339 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::pool_traits_type = typename base_t::pool_traits_type |
Definition at line 338 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::pool_type = typename base_t::pool_type |
Definition at line 342 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::signalled_work_queue_type = typename base_t::signalled_work_queue_type |
Definition at line 345 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::statistics_type = typename base_t::statistics_type |
Definition at line 343 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::thread_traits = typename base_t::thread_traits |
Definition at line 340 of file thread_pool_master.hpp.
using jmmcg::ppd::thread_pool< pool_traits::work_distribution_mode_t::one_thread_distributes<>, pool_traits::size_mode_t::fixed_size, PTT >::work_distribution_mode = typename base_t::work_distribution_mode |
Definition at line 344 of file thread_pool_master.hpp.
|
strong |
Enumerator | |
---|---|
failed_to_erase | |
ignoring_result | |
erased_successfully |
Definition at line 347 of file thread_pool_master.hpp.
|
inlineexplicitnoexcept |
Create the thread pool.
num_threads | The number of threads in the pool, which must be greater than zero. |
Definition at line 357 of file thread_pool_master.hpp.
References jmmcg::ppd::control_flow_graph< OST >::add_cfg_details< Node >::params::params().
|
inlinenoexcept |
The destruction of the collection of threads is sequential, but the threads themselves can exit in parallel, thus speeding up the clean-up of the pool.
Definition at line 369 of file thread_pool_master.hpp.
References jmmcg::ppd::control_flow_graph< OST >::add_cfg_details< Node >::params::params().
|
inline |
Erase the specified, queued work.
Note that if the work has started processing, it will not be erased.
ec | The execution context of the work to erase. |
Definition at line 387 of file thread_pool_master.hpp.
|
inlinenoexcept |
Obtain access to any statistics data collected by the operation of the thread_pool.
Algorithmic complexity when specialised with no_statistics: constant time, otherwise O(pool_size()). Note that the value computed for the statistics_type::total_vertical_work() is guaranteed to be accurate. This type of thread_pool does not perform horizontal threading, because it spawns a thread per closure_base-derived closure, so can never suffer deadlock through resource starvation, therefore the value of statistics_type::total_hrz_work() is zero. Therefore, because of the vagaries of multi-threading the following holds: statistics_type::total_work_added()>=statistics_type::total_vertical_work()+statistics_type::total_hrz_work()
Definition at line 405 of file thread_pool_master.hpp.