libjmmcg
build_2783
A C++ library containing an eclectic mix of useful, advanced components.
|
#include <thread_pool_aspects.hpp>
Public Types | |
using | queue_model = pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue |
using | element_type = shared_ptr< V, typename V::base_t::lock_traits > |
using | exit_requested_type = typename lock::new_event_signal< EvSts, EvSts::unsignalled, EvSts::exit_requested, typename element_type::lock_traits::critical_section_type > |
To be used by the thread_pool to signal that it requires the pool_threads it manages should exit, or have closure_base-derived closure to process. More... | |
using | lock_all_type = typename lock::any_order::all< exit_requested_type::lock_traits::api_type, typename exit_requested_type::lock_traits::model_type, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type > |
using | key_compare = typename ppd::private_::def_key_compare< Comp, element_type >::result |
using | container_type = front_batch< priority_queue< std::priority_queue< element_type, std::vector< element_type >, key_compare >, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type::write_lock_type, signalling< exit_requested_type >, std::array< element_type, GSSk > >, GSSk > |
The signalled_work_queue_type is an adapted list to add some thread-safety, because we need to perform multiple operations on it, atomically. More... | |
using | statistics_type = Stats< typename container_type::size_type > |
using | have_work_type = typename container_type::have_work_type |
Public Member Functions | |
thread_pool_queue_details_front_batch_priority_queue () FORCE_INLINE | |
Public Attributes | |
exit_requested_type | exit_requested_ |
This is one exit event for all of the threads in the pool: so that they can exit in parallel. More... | |
container_type | signalled_work_queue |
Static Public Attributes | |
static constexpr generic_traits::memory_access_modes | memory_access_mode =container_type::memory_access_mode |
Definition at line 315 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::container_type = front_batch< priority_queue< std::priority_queue<element_type, std::vector<element_type>, key_compare>, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type::write_lock_type, signalling<exit_requested_type>, std::array<element_type, GSSk> >, GSSk > |
The signalled_work_queue_type is an adapted list to add some thread-safety, because we need to perform multiple operations on it, atomically.
Basically this has been defined as a FIFO queue that has locking semantics defined by the specific collection used, and implements a simple list-based scheduling algorithm that assumes that each work-item is the same work-load.
The algorithmic complexity of the operations on this container is based upon the complexity of the operations on the underlying container, in this case an instrusive::slist. This specifically implies that adding and removing an item takes constant time.
This queue would simply implement a bakers' scheduling algorithm: i.e. the active pool_thread would remove k items from the front of the queue to be mutated by that thread.
[1] Casanova, H., Legrand, A., Robert, Y., "Parallel Algorithms", CRC Press, 2008.
Definition at line 373 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::element_type = shared_ptr< V, typename V::base_t::lock_traits > |
We don't actually need this to be guaranteed lockfree, as locking is done elsewhere, so we can gain a smidge of performance by using raw pointers.
Definition at line 323 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::exit_requested_type = typename lock::new_event_signal< EvSts, EvSts::unsignalled, EvSts::exit_requested, typename element_type::lock_traits::critical_section_type > |
To be used by the thread_pool to signal that it requires the pool_threads it manages should exit, or have closure_base-derived closure to process.
This is modelling the functionality of "WaitForMultipleObjects(...)" in the Win32 API.
Definition at line 333 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::have_work_type = typename container_type::have_work_type |
Definition at line 375 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::key_compare = typename ppd::private_::def_key_compare<Comp, element_type>::result |
Definition at line 340 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::lock_all_type = typename lock::any_order::all< exit_requested_type::lock_traits::api_type, typename exit_requested_type::lock_traits::model_type, typename exit_requested_type::locker_type, typename exit_requested_type::locker_type > |
Definition at line 339 of file thread_pool_aspects.hpp.
Definition at line 316 of file thread_pool_aspects.hpp.
using jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::statistics_type = Stats<typename container_type::size_type> |
Definition at line 374 of file thread_pool_aspects.hpp.
Definition at line 389 of file thread_pool_aspects.hpp.
References memory_access_mode.
|
mutable |
This is one exit event for all of the threads in the pool: so that they can exit in parallel.
Definition at line 383 of file thread_pool_aspects.hpp.
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 380 of file thread_pool_aspects.hpp.
Referenced by jmmcg::ppd::lock::new_event_signal< St, UnSig, Pri, api_lock_traits< platform_api, sequential_mode >::critical_section_type >::locker(), and thread_pool_queue_details_front_batch_priority_queue().
container_type jmmcg::ppd::pool_traits::private_::thread_pool_queue_details_front_batch_priority_queue< pool_traits::work_distribution_mode_t::queue_model_t::pool_owns_queue, EvSts, Stats, V, Comp, GSSk >::signalled_work_queue |
This implies that the thread_pool assumes a flat memory model, shared across all processors. This may not reflect reality well, in the face of caches.
Definition at line 387 of file thread_pool_aspects.hpp.