libjmmcg
build_2783
A C++ library containing an eclectic mix of useful, advanced components.
|
Class that implements the horizontal execution algorithm. More...
#include <thread_client_context.hpp>
Static Public Attributes | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode |
Static Public Attributes inherited from jmmcg::ppd::private_::horizontal_execution_itf< RD, TPB, Del, AtCtr > | |
static constexpr generic_traits::return_data | result_traits_ =RD |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode |
Protected Types | |
typedef horizontal_execution_itf< RD, TPB, Del, AtCtr > | base_t |
typedef base_t::thread_pool_type | thread_pool_type |
typedef base_t::pool_traits_type | pool_traits_type |
typedef base_t::pool_type | pool_type |
typedef base_t::os_traits | os_traits |
typedef base_t::thread_wk_t | thread_wk_t |
Protected Member Functions | |
horizontal_execution (thread_pool_type &p, thread_wk_t &core_work) noexcept(true) FORCE_INLINE | |
~horizontal_execution () noexcept(false) FORCE_INLINE | |
void __fastcall | wait_or_horizontal_thread () const noexcept(false) final override |
Wait upon the core_work to complete process(), or process() items from the pool::batch_details. More... | |
Protected Member Functions inherited from jmmcg::ppd::private_::horizontal_execution_itf< RD, TPB, Del, AtCtr > | |
constexpr | horizontal_execution_itf () noexcept(true) FORCE_INLINE |
~horizontal_execution_itf () noexcept(true) FORCE_INLINE | |
Can't be used polymorphically - to maintain the concept that this is a stack allocated object. More... | |
virtual work_complete_t &__fastcall | work_complete () noexcept(true)=0 |
virtual work_complete_t &__fastcall | work_complete () const noexcept(true)=0 |
virtual const thread_wk_t &__fastcall | core_work () const noexcept(true)=0 |
bool __fastcall | work_done () const noexcept(true) FORCE_INLINE |
Check to see if the work has been completed. More... | |
Protected Attributes | |
thread_pool_type & | pool |
Additional Inherited Members | |
Public Types inherited from jmmcg::ppd::private_::horizontal_execution_itf< RD, TPB, Del, AtCtr > | |
typedef TPB | thread_pool_type |
typedef thread_pool_type::pool_traits_type | pool_traits_type |
The pool traits. More... | |
typedef thread_pool_type::os_traits | os_traits |
typedef thread_pool_type::pool_type | pool_type |
typedef os_traits::lock_traits::anon_event_type | atomic_t |
typedef os_traits::exception_type | exception_type |
typedef closure::thread_wk_async_t< RD, os_traits, Del, AtCtr, typename pool_traits_type::cfg_type > | thread_wk_t |
typedef thread_wk_t::work_complete_t | work_complete_t |
This atomic object is the object that is used to signal to a waiting future that the work has been completed. More... | |
Public Member Functions inherited from jmmcg::ppd::private_::horizontal_execution_itf< RD, TPB, Del, AtCtr > | |
horizontal_execution_itf (horizontal_execution_itf const &)=delete | |
Class that implements the horizontal execution algorithm.
It wait for work on the main thread_pool::signalled_work_queue at low priority (to try and ensure that the pool_threads are more likely to get the thread_wk_t), takes one item at a time, i.e. no batching, GSS(k), where k=1, and resultant work is placed back into the thread_pool::signalled_work_queue, to be available for all threads.
Due to the PThreads API, which lacks wait for multiple objects, one has to create another thread to execute the work horizontally whilst the execution context is held. Then once the execution context is released, one has to cancel the thread, but be hyper-careful about when one can cancel the thread to ensure that not only is any work it is processing completed, but also that any C++ objects it is holding have their dtors correctly run. Yuck. The thread is created in the call to get_results(), only if the work has not been completed.
Definition at line 662 of file thread_client_context.hpp.
|
protected |
Definition at line 664 of file thread_client_context.hpp.
|
protected |
Definition at line 668 of file thread_client_context.hpp.
|
protected |
Definition at line 666 of file thread_client_context.hpp.
|
protected |
Definition at line 667 of file thread_client_context.hpp.
|
protected |
Definition at line 665 of file thread_client_context.hpp.
|
protected |
Definition at line 669 of file thread_client_context.hpp.
|
inlineprotectednoexcept |
Definition at line 671 of file thread_client_context.hpp.
|
inlineprotectednoexcept |
Definition at line 674 of file thread_client_context.hpp.
|
inlinefinaloverrideprotectedvirtualnoexcept |
Wait upon the core_work to complete process(), or process() items from the pool::batch_details.
When items are directly process()ed from the pool::batch_details whilst waiting for the attaced core_work to complete, I term this as "horizontal threading", as opposed to "vertical threading", which is when core_work items are process()ed in pool_thread pool::thread_types::steal::process(), possibly being batched. This function will attempt to process core_work from the signalled_work_queue, or if the wk_queue_item() upon which it is waiting has been completed, will return. Batching is carefully done: if there are items in the pool::batch_details, then these will be processed first, but only from the same thread as this one.
Reimplemented from jmmcg::ppd::private_::horizontal_execution_itf< RD, TPB, Del, AtCtr >.
Definition at line 683 of file thread_client_context.hpp.
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 839 of file thread_client_context.hpp.
|
protected |
Definition at line 850 of file thread_client_context.hpp.