libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
A class to assist in processing the core_work in the GSS(k) batch, ensuring that items within a batch in a thread are fully processed before any wait in that thread is performed, because we could deadlock. More...
#include <thread_client_context.hpp>
Public Types | |
typedef WQ | signalled_work_queue_type |
This is a container of GSSk items from the front of the queue to implement the GSS(k) or bakers' scheduling algorithm. More... | |
typedef Stats | statistics_type |
The statistics to be gathered by the thread_pool, by default none. More... | |
typedef signalled_work_queue_type::value_ret_type::value_type::no_ref_counting | no_ref_counting |
typedef signalled_work_queue_type::value_ret_type::value_type::value_type::cfg_type | cfg_type |
using | eval_shared_del_t = eval_shared_deleter_t< typename signalled_work_queue_type::value_ret_type::value_type > |
Public Member Functions | |
BOOST_STATIC_ASSERT (signalled_work_queue_type::max_size<=GSSk) | |
bool __fastcall | batch_empty () const noexcept(true) FORCE_INLINE |
constexpr __stdcall | batch_details () noexcept(true) FORCE_INLINE |
bool __fastcall | add_work_to_batch (typename signalled_work_queue_type::value_type &&wk) noexcept(true) FORCE_INLINE |
Put the closure_base-derived closure in the batch, if it is empty. More... | |
void __fastcall | refill_batch (signalled_work_queue_type &signalled_work_queue) noexcept(false) FORCE_INLINE |
bool __fastcall | process_a_batch_item () noexcept(false) FORCE_INLINE |
void __fastcall | process_a_batch (signalled_work_queue_type &signalled_work_queue) noexcept(false) FORCE_INLINE |
statistics_type const &__fastcall | statistics () const noexcept(true) FORCE_INLINE |
statistics_type &__fastcall | statistics () noexcept(true) FORCE_INLINE |
Static Public Attributes | |
static constexpr unsigned long | GSSk =GSSkSz |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode =eval_shared_del_t::memory_access_mode |
Protected Member Functions | |
void __fastcall | reload_batch_if_empty_nochk_nolk (signalled_work_queue_type &signalled_work_queue) noexcept(false) FORCE_INLINE |
template<class UpdStats > | |
void FORCE_INLINE | process_the_work (UpdStats &&update_stats, typename cfg_type::edge_annotation_t const e_details) noexcept(false) |
Protected Attributes | |
statistics_type | statistics_ |
signalled_work_queue_type::value_ret_type | batched_work |
signalled_work_queue_type::value_ret_type::iterator | current_work_item |
A class to assist in processing the core_work in the GSS(k) batch, ensuring that items within a batch in a thread are fully processed before any wait in that thread is performed, because we could deadlock.
Note that this class is used for the implicit batch contained formed by the main thread in the program that creates the thread_pool.
Definition at line 97 of file thread_client_context.hpp.
typedef signalled_work_queue_type::value_ret_type::value_type::value_type::cfg_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::cfg_type |
Definition at line 104 of file thread_client_context.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::eval_shared_del_t = eval_shared_deleter_t<typename signalled_work_queue_type::value_ret_type::value_type> |
Definition at line 105 of file thread_client_context.hpp.
typedef signalled_work_queue_type::value_ret_type::value_type::no_ref_counting jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::no_ref_counting |
Definition at line 103 of file thread_client_context.hpp.
typedef WQ jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::signalled_work_queue_type |
This is a container of GSSk items from the front of the queue to implement the GSS(k) or bakers' scheduling algorithm.
Definition at line 100 of file thread_client_context.hpp.
typedef Stats jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics_type |
The statistics to be gathered by the thread_pool, by default none.
Definition at line 102 of file thread_client_context.hpp.
|
inlineconstexprnoexcept |
Definition at line 145 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batched_work, jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::current_work_item, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics_.
|
inlinenoexcept |
Put the closure_base-derived closure in the batch, if it is empty.
Note that this function runs with no locks, as it presumes that the caller is the same pool_thread that consumes the work from the batch.
wk | The closure_base-derived closure to attempt to add. |
Definition at line 158 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batched_work, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::current_work_item.
|
inlinenoexcept |
Definition at line 124 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batched_work, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::current_work_item.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::add_work_to_batch(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch_item(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::reload_batch_if_empty_nochk_nolk().
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::BOOST_STATIC_ASSERT | ( | signalled_work_queue_type::max_size<= | GSSk | ) |
Make sure that the batch_size's are the same, so that when a batch is popped off the signalled_work_queue, all of the elements are copied, with none being lost, which would cause closure_base-derived closure not to be processed.
|
inlinenoexcept |
If the batch_size>1 and the first closure_base-derived closure depends upon a later job to complete, then that sub-tree of dependent closure_base-derived closures will deadlock. This is because this loop will wait for the first closure_base-derived closure to complete, which depends upon the second (or later in the batch) closure_base-derived closure which will not be executed as the earlier closure_base-derived closure is preventing this loop for continuing.
Definition at line 194 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::refill_batch(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics_.
|
inlinenoexcept |
Definition at line 183 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batched_work, jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::current_work_item, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics_.
|
inlineprotectednoexcept |
Definition at line 138 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::current_work_item.
|
inlinenoexcept |
Definition at line 170 of file thread_client_context.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch().
|
inlineprotectednoexcept |
Definition at line 129 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batched_work, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::current_work_item.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::refill_batch().
|
inlinenoexcept |
Definition at line 201 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics_.
|
inlinenoexcept |
Definition at line 204 of file thread_client_context.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics_.
|
protected |
Definition at line 210 of file thread_client_context.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::add_work_to_batch(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_details(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch_item(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::reload_batch_if_empty_nochk_nolk().
|
protected |
Definition at line 211 of file thread_client_context.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::add_work_to_batch(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_details(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch_item(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_the_work(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::reload_batch_if_empty_nochk_nolk().
|
staticconstexpr |
Definition at line 107 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 112 of file thread_client_context.hpp.
|
protected |
Definition at line 209 of file thread_client_context.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::batch_details(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::process_a_batch_item(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::batch_details< GSSkSz, WQ, Stats >::statistics().