Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
PTL::TaskGroup< Tp, Arg, MaxDepth > Class Template Reference

#include <TaskGroup.hh>

Public Types

using ArgTp = decay_t< Arg >
 
using atomic_int = std::atomic_intmax_t
 
using atomic_uint = std::atomic_uintmax_t
 
using condition_t = Condition
 
using const_iterator = typename future_list_t::const_iterator
 
using const_reverse_iterator = typename future_list_t::const_reverse_iterator
 
template<typename Up >
using container_type = std::vector< Up >
 
using future_list_t = container_type< future_type >
 
using future_type = std::future< ArgTp >
 
using iterator = typename future_list_t::iterator
 
using join_type = typename JoinFunction< Tp, Arg >::Type
 
using lock_t = Mutex
 
using packaged_task_type = std::packaged_task< ArgTp()>
 
using promise_type = std::promise< ArgTp >
 
using result_type = Tp
 
using reverse_iterator = typename future_list_t::reverse_iterator
 
using size_type = uintmax_t
 
using task_list_t = container_type< task_pointer >
 
using task_pointer = std::shared_ptr< TaskFuture< ArgTp > >
 
template<typename... Args>
using task_type = Task< ArgTp, decay_t< Args >... >
 
using this_type = TaskGroup< Tp, Arg, MaxDepth >
 
using tid_type = std::thread::id
 

Public Member Functions

itr_t begin ()
 
citr_t begin () const
 
citr_t cbegin () const
 
citr_t cend () const
 
void clear ()
 
itr_t end ()
 
citr_t end () const
 
template<typename Func , typename... Args, typename Up = Tp>
enable_if_t< std::is_void< Up >::value, void > exec (Func func, Args... args)
 
template<typename Func , typename... Args, typename Up = Tp>
enable_if_t<!std::is_void< Up >::value, void > exec (Func func, Args... args)
 
ScopeDestructor get_scope_destructor ()
 
future_list_tget_tasks ()
 
const future_list_tget_tasks () const
 
uintmax_t id () const
 
bool is_main () const
 
bool is_native_task_group () const
 
template<typename Up = Tp, typename Rp = Arg, enable_if_t< std::is_void< Up >::value &&std::is_void< Rp >::value, int > = 0>
void join ()
 
template<typename Up = Tp, typename Rp = Arg, enable_if_t< std::is_void< Up >::value &&!std::is_void< Rp >::value, int > = 0>
void join ()
 
template<typename Up = Tp, enable_if_t<!std::is_void< Up >::value, int > = 0>
Up join (Up accum={})
 
void notify ()
 
void notify_all ()
 
intmax_t operator++ ()
 
intmax_t operator++ (int)
 
template<typename Up >
std::shared_ptr< Up > operator+= (std::shared_ptr< Up > &&_task)
 
intmax_t operator-- ()
 
intmax_t operator-- (int)
 
this_typeoperator= (const this_type &rhs)=delete
 
this_typeoperator= (this_type &&rhs)=default
 
intmax_t pending ()
 
ThreadPool *& pool ()
 
ThreadPoolpool () const
 
ritr_t rbegin ()
 
critr_t rbegin () const
 
ritr_t rend ()
 
critr_t rend () const
 
void reserve (size_t _n)
 
template<typename Func , typename... Args>
void run (Func func, Args... args)
 
void set_pool (ThreadPool *tp)
 
intmax_t size () const
 
condition_ttask_cond ()
 
lock_ttask_lock ()
 
 TaskGroup (const this_type &)=delete
 
template<typename Func >
 TaskGroup (Func &&_join, ThreadPool *_tp=internal::get_default_threadpool())
 
 TaskGroup (this_type &&rhs)=default
 
template<typename Up = Tp>
 TaskGroup (ThreadPool *_tp=internal::get_default_threadpool(), enable_if_t< std::is_void< Up >::value, int >=0)
 
void wait ()
 
template<typename Func , typename... Args>
std::shared_ptr< task_type< Args... > > wrap (Func func, Args... args)
 
 ~TaskGroup ()
 

Static Public Member Functions

static void set_verbose (int level)
 

Protected Types

using citr_t = const_iterator
 
using critr_t = const_reverse_iterator
 
using itr_t = iterator
 
using ritr_t = reverse_iterator
 

Protected Member Functions

template<typename Up , typename Func , typename... Args>
enable_if_t< std::is_void< Up >::value, void > local_exec (Func func, Args... args)
 
template<typename Up , typename Func , typename... Args>
enable_if_t<!std::is_void< Up >::value, void > local_exec (Func func, Args... args)
 
atomic_inttask_count ()
 
const atomic_inttask_count () const
 

Static Protected Member Functions

static tid_type this_tid ()
 

Protected Attributes

intmax_t m_depth = internal::get_task_depth()
 
future_list_t m_future_list = {}
 
uintmax_t m_id = internal::task_group_counter()++
 
join_type m_join {}
 
tid_type m_main_tid = std::this_thread::get_id()
 
ThreadPoolm_pool = internal::get_default_threadpool()
 
condition_t m_task_cond = {}
 
task_list_t m_task_list = {}
 
lock_t m_task_lock = {}
 
tbb_task_group_tm_tbb_task_group = nullptr
 
atomic_int m_tot_task_count { 0 }
 

Static Protected Attributes

static int f_verbose
 

Private Member Functions

void internal_update ()
 

Detailed Description

template<typename Tp, typename Arg = Tp, intmax_t MaxDepth = 0>
class PTL::TaskGroup< Tp, Arg, MaxDepth >

Definition at line 66 of file TaskGroup.hh.

Member Typedef Documentation

◆ ArgTp

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::ArgTp = decay_t<Arg>

Definition at line 79 of file TaskGroup.hh.

◆ atomic_int

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::atomic_int = std::atomic_intmax_t

Definition at line 76 of file TaskGroup.hh.

◆ atomic_uint

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::atomic_uint = std::atomic_uintmax_t

Definition at line 77 of file TaskGroup.hh.

◆ citr_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::citr_t = const_iterator
protected

Definition at line 194 of file TaskGroup.hh.

◆ condition_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::condition_t = Condition

Definition at line 78 of file TaskGroup.hh.

◆ const_iterator

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::const_iterator = typename future_list_t::const_iterator

Definition at line 91 of file TaskGroup.hh.

◆ const_reverse_iterator

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::const_reverse_iterator = typename future_list_t::const_reverse_iterator

Definition at line 92 of file TaskGroup.hh.

◆ container_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up >
using PTL::TaskGroup< Tp, Arg, MaxDepth >::container_type = std::vector<Up>

Definition at line 71 of file TaskGroup.hh.

◆ critr_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::critr_t = const_reverse_iterator
protected

Definition at line 196 of file TaskGroup.hh.

◆ future_list_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::future_list_t = container_type<future_type>

Definition at line 87 of file TaskGroup.hh.

◆ future_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::future_type = std::future<ArgTp>

Definition at line 85 of file TaskGroup.hh.

◆ iterator

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::iterator = typename future_list_t::iterator

Definition at line 89 of file TaskGroup.hh.

◆ itr_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::itr_t = iterator
protected

Definition at line 193 of file TaskGroup.hh.

◆ join_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::join_type = typename JoinFunction<Tp, Arg>::Type

Definition at line 88 of file TaskGroup.hh.

◆ lock_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::lock_t = Mutex

Definition at line 75 of file TaskGroup.hh.

◆ packaged_task_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::packaged_task_type = std::packaged_task<ArgTp()>

Definition at line 86 of file TaskGroup.hh.

◆ promise_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::promise_type = std::promise<ArgTp>

Definition at line 84 of file TaskGroup.hh.

◆ result_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::result_type = Tp

Definition at line 80 of file TaskGroup.hh.

◆ reverse_iterator

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::reverse_iterator = typename future_list_t::reverse_iterator

Definition at line 90 of file TaskGroup.hh.

◆ ritr_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::ritr_t = reverse_iterator
protected

Definition at line 195 of file TaskGroup.hh.

◆ size_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::size_type = uintmax_t

Definition at line 74 of file TaskGroup.hh.

◆ task_list_t

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::task_list_t = container_type<task_pointer>

Definition at line 82 of file TaskGroup.hh.

◆ task_pointer

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::task_pointer = std::shared_ptr<TaskFuture<ArgTp> >

Definition at line 81 of file TaskGroup.hh.

◆ task_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename... Args>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::task_type = Task<ArgTp, decay_t<Args>...>

Definition at line 95 of file TaskGroup.hh.

◆ this_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::this_type = TaskGroup<Tp, Arg, MaxDepth>

Definition at line 83 of file TaskGroup.hh.

◆ tid_type

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
using PTL::TaskGroup< Tp, Arg, MaxDepth >::tid_type = std::thread::id

Definition at line 73 of file TaskGroup.hh.

Constructor & Destructor Documentation

◆ TaskGroup() [1/4]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Func >
PTL::TaskGroup< Tp, Arg, MaxDepth >::TaskGroup ( Func &&  _join,
ThreadPool _tp = internal::get_default_threadpool() 
)

◆ TaskGroup() [2/4]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up = Tp>
PTL::TaskGroup< Tp, Arg, MaxDepth >::TaskGroup ( ThreadPool _tp = internal::get_default_threadpool(),
enable_if_t< std::is_void< Up >::value, int >  = 0 
)

◆ ~TaskGroup()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
PTL::TaskGroup< Tp, Arg, MaxDepth >::~TaskGroup ( )

◆ TaskGroup() [3/4]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
PTL::TaskGroup< Tp, Arg, MaxDepth >::TaskGroup ( const this_type )
delete

◆ TaskGroup() [4/4]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
PTL::TaskGroup< Tp, Arg, MaxDepth >::TaskGroup ( this_type &&  rhs)
default

Member Function Documentation

◆ begin() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
itr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::begin ( )
inline

Definition at line 208 of file TaskGroup.hh.

208{ return m_future_list.begin(); }
future_list_t m_future_list
Definition: TaskGroup.hh:260

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ begin() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
citr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::begin ( ) const
inline

Definition at line 210 of file TaskGroup.hh.

210{ return m_future_list.begin(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ cbegin()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
citr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::cbegin ( ) const
inline

Definition at line 212 of file TaskGroup.hh.

212{ return m_future_list.begin(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ cend()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
citr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::cend ( ) const
inline

Definition at line 213 of file TaskGroup.hh.

213{ return m_future_list.end(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ clear()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::clear ( )

◆ end() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
itr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::end ( )
inline

Definition at line 209 of file TaskGroup.hh.

209{ return m_future_list.end(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ end() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
citr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::end ( ) const
inline

Definition at line 211 of file TaskGroup.hh.

211{ return m_future_list.end(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ exec() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Func , typename... Args, typename Up = Tp>
enable_if_t< std::is_void< Up >::value, void > PTL::TaskGroup< Tp, Arg, MaxDepth >::exec ( Func  func,
Args...  args 
)

◆ exec() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Func , typename... Args, typename Up = Tp>
enable_if_t<!std::is_void< Up >::value, void > PTL::TaskGroup< Tp, Arg, MaxDepth >::exec ( Func  func,
Args...  args 
)

◆ get_scope_destructor()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
ScopeDestructor PTL::TaskGroup< Tp, Arg, MaxDepth >::get_scope_destructor ( )

◆ get_tasks() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
future_list_t & PTL::TaskGroup< Tp, Arg, MaxDepth >::get_tasks ( )
inline

Definition at line 202 of file TaskGroup.hh.

202{ return m_future_list; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ get_tasks() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
const future_list_t & PTL::TaskGroup< Tp, Arg, MaxDepth >::get_tasks ( ) const
inline

Definition at line 203 of file TaskGroup.hh.

203{ return m_future_list; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ id()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
uintmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::id ( ) const
inline

Definition at line 140 of file TaskGroup.hh.

140{ return m_id; }
uintmax_t m_id
Definition: TaskGroup.hh:250

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_id.

◆ internal_update()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::internal_update ( )
private

◆ is_main()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
bool PTL::TaskGroup< Tp, Arg, MaxDepth >::is_main ( ) const
inline

Definition at line 148 of file TaskGroup.hh.

148{ return this_tid() == m_main_tid; }
static tid_type this_tid()
Definition: TaskGroup.hh:240
tid_type m_main_tid
Definition: TaskGroup.hh:252

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_main_tid, and PTL::TaskGroup< Tp, Arg, MaxDepth >::this_tid().

◆ is_native_task_group()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
bool PTL::TaskGroup< Tp, Arg, MaxDepth >::is_native_task_group ( ) const
inline

Definition at line 147 of file TaskGroup.hh.

147{ return (m_tbb_task_group) ? false : true; }
tbb_task_group_t * m_tbb_task_group
Definition: TaskGroup.hh:258

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tbb_task_group.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::wrap().

◆ join() [1/3]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up = Tp, typename Rp = Arg, enable_if_t< std::is_void< Up >::value &&std::is_void< Rp >::value, int > = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::join ( )
inline

◆ join() [2/3]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up = Tp, typename Rp = Arg, enable_if_t< std::is_void< Up >::value &&!std::is_void< Rp >::value, int > = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::join ( )
inline

◆ join() [3/3]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up = Tp, enable_if_t<!std::is_void< Up >::value, int > = 0>
Up PTL::TaskGroup< Tp, Arg, MaxDepth >::join ( Up  accum = {})
inline

◆ local_exec() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up , typename Func , typename... Args>
enable_if_t< std::is_void< Up >::value, void > PTL::TaskGroup< Tp, Arg, MaxDepth >::local_exec ( Func  func,
Args...  args 
)
protected

◆ local_exec() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up , typename Func , typename... Args>
enable_if_t<!std::is_void< Up >::value, void > PTL::TaskGroup< Tp, Arg, MaxDepth >::local_exec ( Func  func,
Args...  args 
)
protected

◆ notify()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::notify ( )

◆ notify_all()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::notify_all ( )

◆ operator++() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::operator++ ( )
inline

Definition at line 127 of file TaskGroup.hh.

127{ return ++(m_tot_task_count); }
atomic_int m_tot_task_count
Definition: TaskGroup.hh:253

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ operator++() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::operator++ ( int  )
inline

Definition at line 128 of file TaskGroup.hh.

128{ return (m_tot_task_count)++; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ operator+=()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Up >
std::shared_ptr< Up > PTL::TaskGroup< Tp, Arg, MaxDepth >::operator+= ( std::shared_ptr< Up > &&  _task)

◆ operator--() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::operator-- ( )
inline

Definition at line 129 of file TaskGroup.hh.

129{ return --(m_tot_task_count); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ operator--() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::operator-- ( int  )
inline

Definition at line 130 of file TaskGroup.hh.

130{ return (m_tot_task_count)--; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ operator=() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
this_type & PTL::TaskGroup< Tp, Arg, MaxDepth >::operator= ( const this_type rhs)
delete

◆ operator=() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
this_type & PTL::TaskGroup< Tp, Arg, MaxDepth >::operator= ( this_type &&  rhs)
default

◆ pending()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::pending ( )
inline

Definition at line 151 of file TaskGroup.hh.

151{ return m_tot_task_count.load(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ pool() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
ThreadPool *& PTL::TaskGroup< Tp, Arg, MaxDepth >::pool ( )
inline

Definition at line 144 of file TaskGroup.hh.

144{ return m_pool; }
ThreadPool * m_pool
Definition: TaskGroup.hh:257

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_pool.

◆ pool() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
ThreadPool * PTL::TaskGroup< Tp, Arg, MaxDepth >::pool ( ) const
inline

Definition at line 145 of file TaskGroup.hh.

145{ return m_pool; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_pool.

◆ rbegin() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
ritr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::rbegin ( )
inline

Definition at line 214 of file TaskGroup.hh.

214{ return m_future_list.rbegin(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ rbegin() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
critr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::rbegin ( ) const
inline

Definition at line 216 of file TaskGroup.hh.

216{ return m_future_list.rbegin(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ rend() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
ritr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::rend ( )
inline

Definition at line 215 of file TaskGroup.hh.

215{ return m_future_list.rend(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ rend() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
critr_t PTL::TaskGroup< Tp, Arg, MaxDepth >::rend ( ) const
inline

Definition at line 217 of file TaskGroup.hh.

217{ return m_future_list.rend(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list.

◆ reserve()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::reserve ( size_t  _n)
inline

Definition at line 159 of file TaskGroup.hh.

160 {
161 m_task_list.reserve(_n);
162 m_future_list.reserve(_n);
163 }
task_list_t m_task_list
Definition: TaskGroup.hh:259

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list, and PTL::TaskGroup< Tp, Arg, MaxDepth >::m_task_list.

◆ run()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Func , typename... Args>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::run ( Func  func,
Args...  args 
)
inline

Definition at line 180 of file TaskGroup.hh.

181 {
182 exec(std::move(func), std::move(args)...);
183 }
static char ** args
Definition: G4Xt.cc:51
enable_if_t< std::is_void< Up >::value, void > exec(Func func, Args... args)

References args, and PTL::TaskGroup< Tp, Arg, MaxDepth >::exec().

◆ set_pool()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::set_pool ( ThreadPool tp)
inline

◆ set_verbose()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
static void PTL::TaskGroup< Tp, Arg, MaxDepth >::set_verbose ( int  level)
inlinestatic

Definition at line 153 of file TaskGroup.hh.

153{ f_verbose = level; }
static int f_verbose
Definition: TaskGroup.hh:248

References PTL::TaskGroup< Tp, Arg, MaxDepth >::f_verbose.

◆ size()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::size ( ) const
inline

Definition at line 133 of file TaskGroup.hh.

133{ return m_tot_task_count.load(); }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ task_cond()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
condition_t & PTL::TaskGroup< Tp, Arg, MaxDepth >::task_cond ( )
inline

Definition at line 137 of file TaskGroup.hh.

137{ return m_task_cond; }
condition_t m_task_cond
Definition: TaskGroup.hh:255

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_task_cond.

◆ task_count() [1/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
atomic_int & PTL::TaskGroup< Tp, Arg, MaxDepth >::task_count ( )
inlineprotected

Definition at line 244 of file TaskGroup.hh.

244{ return m_tot_task_count; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ task_count() [2/2]

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
const atomic_int & PTL::TaskGroup< Tp, Arg, MaxDepth >::task_count ( ) const
inlineprotected

Definition at line 245 of file TaskGroup.hh.

245{ return m_tot_task_count; }

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count.

◆ task_lock()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
lock_t & PTL::TaskGroup< Tp, Arg, MaxDepth >::task_lock ( )
inline

Definition at line 136 of file TaskGroup.hh.

136{ return m_task_lock; }
lock_t m_task_lock
Definition: TaskGroup.hh:254

References PTL::TaskGroup< Tp, Arg, MaxDepth >::m_task_lock.

◆ this_tid()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
static tid_type PTL::TaskGroup< Tp, Arg, MaxDepth >::this_tid ( )
inlinestaticprotected

Definition at line 240 of file TaskGroup.hh.

240{ return std::this_thread::get_id(); }

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::is_main().

◆ wait()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
void PTL::TaskGroup< Tp, Arg, MaxDepth >::wait ( )

◆ wrap()

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
template<typename Func , typename... Args>
std::shared_ptr< task_type< Args... > > PTL::TaskGroup< Tp, Arg, MaxDepth >::wrap ( Func  func,
Args...  args 
)
inline

Definition at line 167 of file TaskGroup.hh.

168 {
169 return operator+=(std::make_shared<task_type<Args...>>(
170 is_native_task_group(), m_depth, std::move(func), std::move(args)...));
171 }
bool is_native_task_group() const
Definition: TaskGroup.hh:147
intmax_t m_depth
Definition: TaskGroup.hh:251
std::shared_ptr< Up > operator+=(std::shared_ptr< Up > &&_task)

References args, PTL::TaskGroup< Tp, Arg, MaxDepth >::is_native_task_group(), PTL::TaskGroup< Tp, Arg, MaxDepth >::m_depth, and PTL::TaskGroup< Tp, Arg, MaxDepth >::operator+=().

Referenced by PTL::TaskManager::wrap().

Field Documentation

◆ f_verbose

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
int PTL::TaskGroup< Tp, Arg, MaxDepth >::f_verbose
staticprotected

Definition at line 248 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::set_verbose().

◆ m_depth

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
intmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::m_depth = internal::get_task_depth()
protected

Definition at line 251 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::wrap().

◆ m_future_list

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
future_list_t PTL::TaskGroup< Tp, Arg, MaxDepth >::m_future_list = {}
protected

◆ m_id

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
uintmax_t PTL::TaskGroup< Tp, Arg, MaxDepth >::m_id = internal::task_group_counter()++
protected

Definition at line 250 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::id().

◆ m_join

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
join_type PTL::TaskGroup< Tp, Arg, MaxDepth >::m_join {}
protected

Definition at line 256 of file TaskGroup.hh.

◆ m_main_tid

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
tid_type PTL::TaskGroup< Tp, Arg, MaxDepth >::m_main_tid = std::this_thread::get_id()
protected

Definition at line 252 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::is_main().

◆ m_pool

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
ThreadPool* PTL::TaskGroup< Tp, Arg, MaxDepth >::m_pool = internal::get_default_threadpool()
protected

◆ m_task_cond

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
condition_t PTL::TaskGroup< Tp, Arg, MaxDepth >::m_task_cond = {}
protected

Definition at line 255 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::task_cond().

◆ m_task_list

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
task_list_t PTL::TaskGroup< Tp, Arg, MaxDepth >::m_task_list = {}
protected

Definition at line 259 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::reserve().

◆ m_task_lock

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
lock_t PTL::TaskGroup< Tp, Arg, MaxDepth >::m_task_lock = {}
protected

Definition at line 254 of file TaskGroup.hh.

Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::task_lock().

◆ m_tbb_task_group

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
tbb_task_group_t* PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tbb_task_group = nullptr
protected

◆ m_tot_task_count

template<typename Tp , typename Arg = Tp, intmax_t MaxDepth = 0>
atomic_int PTL::TaskGroup< Tp, Arg, MaxDepth >::m_tot_task_count { 0 }
protected

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