libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB > Class Template Reference

A modifier to allow joinably transferring the work to the pool. More...

#include <thread_dsel_types.hpp>

Inheritance diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >:
[legend]

Public Types

typedef TPB thread_pool_type
 
typedef thread_pool_type::pool_traits_type pool_traits_type
 
typedef thread_pool_type::os_traits os_traits
 
typedef thread_pool_type::priority_type priority_type
 

Public Member Functions

constexpr joinable_t (const cliques::element_type c=1) noexcept(true) FORCE_INLINE
 
template<class T >
constexpr FORCE_INLINE joinable_t (T const *parent, typename pool_traits_type::thread_wk_elem_type::cfg_type::node_property_t::value_type const details[], const cliques::element_type c=1) noexcept(true)
 
constexpr joinable_t (thread_pool_type &p, const cliques::element_type c, typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params const &cfg_p) noexcept(true) FORCE_INLINE
 
constexpr joinable_t (joinable_t const &j, thread_pool_type &p) noexcept(true) FORCE_INLINE
 
template<class InpWk >
thread_pool_type::template execution_context_stack< InpWk > __fastcall FORCE_INLINE push_back (InpWk &&wk) noexcept(false)
 Joinably transfer the closure_base-derived closure to the thread_pool. More...
 
template<class Alg >
Alg::execution_context __fastcall FORCE_INLINE push_back (parallel_algorithm< Alg > &&wk) noexcept(false)
 
template<class R , class F , class L >
thread_pool_type::template execution_context_stack< wrap_boost_bind_t< boost::_bi::bind_t< R, F, L > > > FORCE_INLINE operator<< (boost::_bi::bind_t< R, F, L > &&wk) noexcept(false)
 
template<template< class, class, class > class B, class R , class F , class L , class Test = typename std::enable_if<std::is_bind_expression<B<R, F, L>>::value>::type>
thread_pool_type::template execution_context_stack< wrap_std_bind_t< B< R, F, L > > > FORCE_INLINE operator<< (B< R, F, L > &&wk) noexcept(false)
 
template<class InpWk >
thread_pool_type::template execution_context_stack< InpWk > FORCE_INLINE operator<< (InpWk &&wk) noexcept(false)
 
template<class Alg >
Alg::execution_context __fastcall FORCE_INLINE operator<< (parallel_algorithm< Alg > &&wk) noexcept(false)
 
template<typename thread_pool_type::priority_type Pri>
priority_t< joinable_t, TPB, Pri > __fastcall FORCE_INLINE operator<< (typename thread_pool_type::template priority< Pri >) noexcept(true)
 Joinably transfer the closure_base-derived closure, which will be process()ed at the specified priority. More...
 
cliques_t< joinable_t > __fastcall FORCE_INLINE operator<< (cliques &&c) noexcept(true)
 Joinably transfer the closure_base-derived closure, using a sub-set of the pool_threads within the thread_pool. More...
 

Static Public Attributes

static constexpr generic_traits::return_data result_traits_ =generic_traits::return_data::joinable
 

Detailed Description

template<class TPB>
class jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >

A modifier to allow joinably transferring the work to the pool.

If this is used to add work to a pool, and an execution_context does not capture the result, then the result is UB.

Todo:
Clearly the above is undesirable, and it would be better if we could somehow force the compiler to emit an error if the user fails to capture the result.

Definition at line 658 of file thread_dsel_types.hpp.

Member Typedef Documentation

◆ os_traits

template<class TPB >
typedef thread_pool_type::os_traits jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::os_traits

Definition at line 662 of file thread_dsel_types.hpp.

◆ pool_traits_type

template<class TPB >
typedef thread_pool_type::pool_traits_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::pool_traits_type

Definition at line 661 of file thread_dsel_types.hpp.

◆ priority_type

template<class TPB >
typedef thread_pool_type::priority_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::priority_type

Definition at line 663 of file thread_dsel_types.hpp.

◆ thread_pool_type

Definition at line 660 of file thread_dsel_types.hpp.

Constructor & Destructor Documentation

◆ joinable_t() [1/4]

template<class TPB >
constexpr jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::joinable_t ( const cliques::element_type  c = 1)
inlineexplicitconstexprnoexcept

Definition at line 667 of file thread_dsel_types.hpp.

◆ joinable_t() [2/4]

template<class TPB >
template<class T >
constexpr FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::joinable_t ( T const *  parent,
typename pool_traits_type::thread_wk_elem_type::cfg_type::node_property_t::value_type const  details[],
const cliques::element_type  c = 1 
)
inlineconstexprnoexcept

Definition at line 671 of file thread_dsel_types.hpp.

◆ joinable_t() [3/4]

template<class TPB >
constexpr jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::joinable_t ( thread_pool_type p,
const cliques::element_type  c,
typename pool_traits_type::thread_wk_elem_type::cfg_details_type::params const &  cfg_p 
)
inlineconstexprnoexcept

Definition at line 674 of file thread_dsel_types.hpp.

◆ joinable_t() [4/4]

template<class TPB >
constexpr jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::joinable_t ( joinable_t< TPB > const &  j,
thread_pool_type p 
)
inlineconstexprnoexcept

Definition at line 677 of file thread_dsel_types.hpp.

Member Function Documentation

◆ operator<<() [1/6]

template<class TPB >
template<template< class, class, class > class B, class R , class F , class L , class Test = typename std::enable_if<std::is_bind_expression<B<R, F, L>>::value>::type>
thread_pool_type::template execution_context_stack<wrap_std_bind_t<B<R, F, L> > > FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::operator<< ( B< R, F, L > &&  wk)
inlinenoexcept

Definition at line 729 of file thread_dsel_types.hpp.

◆ operator<<() [2/6]

template<class TPB >
template<class R , class F , class L >
thread_pool_type::template execution_context_stack<wrap_boost_bind_t<boost::_bi::bind_t<R, F, L> > > FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::operator<< ( boost::_bi::bind_t< R, F, L > &&  wk)
inlinenoexcept

Definition at line 717 of file thread_dsel_types.hpp.

◆ operator<<() [3/6]

template<class TPB >
cliques_t<joinable_t> __fastcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::operator<< ( cliques &&  c)
inlinenoexcept

Joinably transfer the closure_base-derived closure, using a sub-set of the pool_threads within the thread_pool.

Parameters
cThe number of cliques into which the thread_pool should be divided.
See also
cliques, cliques_t

Definition at line 767 of file thread_dsel_types.hpp.

References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::sequential_pool< DM, Ps, P >::joinable_t, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::cliques::number.

◆ operator<<() [4/6]

template<class TPB >
template<class InpWk >
thread_pool_type::template execution_context_stack<InpWk> FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::operator<< ( InpWk &&  wk)
inlinenoexcept

Definition at line 735 of file thread_dsel_types.hpp.

◆ operator<<() [5/6]

template<class TPB >
template<class Alg >
Alg::execution_context __fastcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::operator<< ( parallel_algorithm< Alg > &&  wk)
inlinenoexcept

Definition at line 742 of file thread_dsel_types.hpp.

◆ operator<<() [6/6]

template<class TPB >
template<typename thread_pool_type::priority_type Pri>
priority_t<joinable_t, TPB, Pri> __fastcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::operator<< ( typename thread_pool_type::template priority< Pri >  )
inlinenoexcept

Joinably transfer the closure_base-derived closure, which will be process()ed at the specified priority.

Todo:
JMG: Hubert Matthews suggested that potentially expression templates could be used here to concatenate the thread_wk_t's that are transferred into the pool; also as an implementation of back_batching, i.e. GSS(k) scheduling.
See also
priority, priority_t

Definition at line 756 of file thread_dsel_types.hpp.

◆ push_back() [1/2]

template<class TPB >
template<class InpWk >
thread_pool_type::template execution_context_stack<InpWk> __fastcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::push_back ( InpWk &&  wk)
inlinenoexcept

Joinably transfer the closure_base-derived closure to the thread_pool.

Verify that the closure_base-derived closure has not been previously transferred, if it has, throw an exception_type. If the implementation-defined result is not captured, the transferred closure_base-derived closure will not be process()ed.

This operation requires no memory allocations, in addition to those required for the operation of the parallel algorithm.

Todo:
JMG: Hubert Matthews suggested that potentially expression templates could be used here to concatenate the thread_wk_t's that are transferred into the pool; also as an implementation of back_batching, i.e. GSS(k) scheduling.
Parameters
wkThe closure_base-derived closure, to be asynchronously executed. The result_type of the closure_base-derived closure is taken from a member typedef. The default mutator function is called process(result_type &) or process(), but you could provide an alternative member-function name if desired, as long as the signature is correct via the declaration of mutator. Note that the process(result_type &) or process() member-function must not be overloaded, or this will not work, also that it must use the __fastcall calling-convention on those platforms that support it.
Returns
An opaque type, derived from an execution_context_stack, that must be captured using "auto const &" or "auto &&"; for requesting the results from the asynchronously process()'d closure_base-derived closure.
See also
create_direct, execution_context_stack

Definition at line 696 of file thread_dsel_types.hpp.

◆ push_back() [2/2]

template<class TPB >
template<class Alg >
Alg::execution_context __fastcall FORCE_INLINE jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::private_::joinable_t< TPB >::push_back ( parallel_algorithm< Alg > &&  wk)
inlinenoexcept

This operation requires no memory allocations, in addition to those required for the operation of the parallel algorithm.

Returns
An opaque type, derived from an execution_context, that must be captured using "auto const &" or "auto &&"; for requesting the results from the asynchronously process()'d closure_base-derived closure.

Definition at line 708 of file thread_dsel_types.hpp.

Member Data Documentation

◆ result_traits_

Definition at line 665 of file thread_dsel_types.hpp.


The documentation for this class was generated from the following file: