1 #ifndef LIBJMMCG_CORE_THREAD_POOL_TRAITS_HPP
2 #define LIBJMMCG_CORE_THREAD_POOL_TRAITS_HPP
123 struct no_op final {};
125 template<
template<
class>
class T,
class V>
126 struct def_key_compare final {
144 template<
class QM,
class EvSts,
class CST,
template<
class>
class Stats,
class Cont,
unsigned long GSSk>
145 struct thread_pool_queue_details_back_batch_queue;
277 template<
class QM,
class EvSts,
template<
class>
class Stats,
class V,
template<
class>
class Comp,
unsigned long GSSk>
278 struct thread_pool_queue_details_front_batch_priority_queue;
279 template<
class EvSts,
template<
class>
class Stats,
class V,
template<
class>
class Comp,
unsigned long GSSk>
359 template<
class TPQD,
unsigned long GSSk>
360 struct pool_thread_queue_details;
362 template<
template<
class>
class TPQD,
unsigned long GSSk>
365 using thread_pool_queue_details=TPQD<queue_model>;
366 using container_type=
typename thread_pool_queue_details::container_type;
367 using os_traits=
typename container_type::value_type::value_type::os_traits;
368 using statistics_type=
typename thread_pool_queue_details::statistics_type;
371 using work_complete_t=
typename os_traits::lock_traits::anon_event_type;
372 using exit_requested_type=
typename thread_pool_queue_details::exit_requested_type;
373 using have_work_type=
typename thread_pool_queue_details::have_work_type;
391 return batch.statistics();
394 return batch.statistics();
408 using thread_pool_queue_details=TPQD<queue_model>;
409 using container_type=
typename thread_pool_queue_details::container_type;
410 using statistics_type=
typename thread_pool_queue_details::statistics_type;
412 BOOST_MPL_ASSERT((std::is_same<std::integral_constant<
unsigned long, GSSk>, std::integral_constant<
unsigned long, 1UL>>));
413 using os_traits=
typename container_type::value_type::value_type::os_traits;
414 using no_ref_counting=
typename container_type::value_type::no_ref_counting;
415 using cfg_type=
typename container_type::value_type::value_type::cfg_type;
417 using work_complete_t=
typename os_traits::lock_traits::anon_spin_event_type;
418 using exit_requested_type=
typename thread_pool_queue_details::exit_requested_type;
419 using have_work_type=
typename thread_pool_queue_details::have_work_type;
454 template<
class>
class Comp,
457 template<
class>
class Stats
465 typename V::base_t::lock_traits
467 using key_compare=
ppd::
private_::no_op<
typename internal_container::value_type>;
485 template<
class>
class Comp,
488 template<
class>
class Stats
496 typename V::base_t::lock_traits
498 using key_compare=
ppd::
private_::no_op<
typename internal_container::value_type>;
502 using typename internal_container::value_type;
514 this->push(
std::forward<value_type>(v));
536 template<
class>
class Comp,
539 template<
class>
class Stats
547 typename V::base_t::lock_traits
549 using key_compare=
ppd::
private_::no_op<
typename internal_container::value_type>;
550 using lock_traits=
typename internal_container::value_type::lock_traits;
551 using os_traits=
typename internal_container::value_type::value_type::os_traits;
552 using thread_traits=
typename os_traits::thread_traits;
556 using typename internal_container::value_type;
557 using value_ret_type=internal_container;
562 : internal_container() {}
575 this->push(
std::forward<value_type>(v));
578 return this->pop_top_nochk();
597 template<
class>
class Comp,
600 template<
class>
class Stats
633 template<
class,
template<
class>
class,
class,
unsigned long,
template<
class>
class>
class PM,
634 template<
class>
class Comp=
private_::no_op,
635 unsigned long GSSkSz=1,
650 static constexpr unsigned long GSSk=GSSkSz;
656 template<
class V>
using atomic_wrapper_t=
typename os_traits::lock_traits::
template atomic_counter_type<V>;
663 template<
generic_traits::
return_data RD1,
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr>
666 template<
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr>
667 struct thread_wk<
generic_traits::
return_data::
joinable,
ThrW,
WFlg,
Del,
AtCtr>
final :
public private_::
closure::
thread_wk<
generic_traits::
return_data::
joinable,
os_traits,
ThrW,
WFlg,
Del,
AtCtr,
cfg_type> {
680 template<
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr>
681 struct thread_wk<
generic_traits::
return_data::
nonjoinable,
ThrW,
WFlg,
Del,
AtCtr>
final :
public private_::
closure::
thread_wk<
generic_traits::
return_data::
nonjoinable,
os_traits,
ThrW,
WFlg,
Del,
AtCtr,
cfg_type> {
698 template<
class ThrW,
class WFlg,
template<
class>
class Del,
template<
class>
class AtCtr>
699 struct algo_thread_wk final :
public private_::closure::algo_thread_wk<os_traits, ThrW, WFlg, Del, AtCtr, cfg_type> {
712 template<
class ThrW,
class WFlg,
class SubDivAlgWk,
template<
class>
class Del=
default_delete,
template<
class>
class AtCtr=atomic_wrapper_t>
713 struct algo_thread_wk_buffered final :
public private_::closure::algo_thread_wk_buffered<os_traits, ThrW, WFlg, SubDivAlgWk, Del, AtCtr, cfg_type> {