Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
|
#include <TaskGroup.hh>
Public Types | |
template<typename Up > | |
using | container_type = std::vector< Up > |
using | tid_type = std::thread::id |
using | size_type = uintmax_t |
using | lock_t = Mutex |
using | atomic_int = std::atomic_intmax_t |
using | atomic_uint = std::atomic_uintmax_t |
using | condition_t = Condition |
using | ArgTp = decay_t< Arg > |
using | result_type = Tp |
using | task_pointer = std::shared_ptr< TaskFuture< ArgTp > > |
using | task_list_t = container_type< task_pointer > |
using | this_type = TaskGroup< Tp, Arg, MaxDepth > |
using | promise_type = std::promise< ArgTp > |
using | future_type = std::future< ArgTp > |
using | packaged_task_type = std::packaged_task< ArgTp()> |
using | future_list_t = container_type< future_type > |
using | join_type = typename JoinFunction< Tp, Arg >::Type |
using | iterator = typename future_list_t::iterator |
using | reverse_iterator = typename future_list_t::reverse_iterator |
using | const_iterator = typename future_list_t::const_iterator |
using | const_reverse_iterator = typename future_list_t::const_reverse_iterator |
template<typename... Args> | |
using | task_type = Task< ArgTp, decay_t< Args >... > |
Public Member Functions | |
template<typename Func > | |
TaskGroup (Func &&_join, ThreadPool *_tp=internal::get_default_threadpool()) | |
template<typename Up = Tp> | |
TaskGroup (ThreadPool *_tp=internal::get_default_threadpool(), enable_if_t< std::is_void< Up >::value, int >=0) | |
~TaskGroup () | |
TaskGroup (const this_type &)=delete | |
TaskGroup (this_type &&rhs)=default | |
TaskGroup & | operator= (const this_type &rhs)=delete |
TaskGroup & | operator= (this_type &&rhs)=default |
template<typename Up > | |
std::shared_ptr< Up > | operator+= (std::shared_ptr< Up > &&_task) |
void | wait () |
intmax_t | operator++ () |
intmax_t | operator++ (int) |
intmax_t | operator-- () |
intmax_t | operator-- (int) |
intmax_t | size () const |
lock_t & | task_lock () |
condition_t & | task_cond () |
uintmax_t | id () const |
void | set_pool (ThreadPool *tp) |
ThreadPool *& | pool () |
ThreadPool * | pool () const |
bool | is_native_task_group () const |
bool | is_main () const |
intmax_t | pending () |
ScopeDestructor | get_scope_destructor () |
void | notify () |
void | notify_all () |
void | reserve (size_t _n) |
template<typename Func , typename... Args> | |
std::shared_ptr< task_type< Args... > > | wrap (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) |
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> | |
void | run (Func func, Args... args) |
future_list_t & | get_tasks () |
const future_list_t & | get_tasks () const |
itr_t | begin () |
itr_t | end () |
citr_t | begin () const |
citr_t | end () const |
citr_t | cbegin () const |
citr_t | cend () const |
ritr_t | rbegin () |
ritr_t | rend () |
critr_t | rbegin () const |
critr_t | rend () const |
template<typename Up = Tp, enable_if_t<!std::is_void< Up >::value, int > = 0> | |
Up | join (Up accum={}) |
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 () |
void | clear () |
Static Public Member Functions | |
static void | set_verbose (int level) |
Protected Types | |
using | itr_t = iterator |
using | citr_t = const_iterator |
using | ritr_t = reverse_iterator |
using | critr_t = const_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_int & | task_count () |
const atomic_int & | task_count () const |
Static Protected Member Functions | |
static tid_type | this_tid () |
Protected Attributes | |
uintmax_t | m_id = internal::task_group_counter()++ |
intmax_t | m_depth = internal::get_task_depth() |
tid_type | m_main_tid = std::this_thread::get_id() |
atomic_int | m_tot_task_count { 0 } |
lock_t | m_task_lock = {} |
condition_t | m_task_cond = {} |
join_type | m_join {} |
ThreadPool * | m_pool = internal::get_default_threadpool() |
tbb_task_group_t * | m_tbb_task_group = nullptr |
task_list_t | m_task_list = {} |
future_list_t | m_future_list = {} |
Static Protected Attributes | |
static int | f_verbose = GetEnv<int>("PTL_VERBOSE", 0) |
Definition at line 82 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::ArgTp = decay_t<Arg> |
Definition at line 95 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::atomic_int = std::atomic_intmax_t |
Definition at line 92 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::atomic_uint = std::atomic_uintmax_t |
Definition at line 93 of file TaskGroup.hh.
|
protected |
Definition at line 213 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::condition_t = Condition |
Definition at line 94 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::const_iterator = typename future_list_t::const_iterator |
Definition at line 107 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::const_reverse_iterator = typename future_list_t::const_reverse_iterator |
Definition at line 108 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::container_type = std::vector<Up> |
Definition at line 87 of file TaskGroup.hh.
|
protected |
Definition at line 215 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::future_list_t = container_type<future_type> |
Definition at line 103 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::future_type = std::future<ArgTp> |
Definition at line 101 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::iterator = typename future_list_t::iterator |
Definition at line 105 of file TaskGroup.hh.
|
protected |
Definition at line 212 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::join_type = typename JoinFunction<Tp, Arg>::Type |
Definition at line 104 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::lock_t = Mutex |
Definition at line 91 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::packaged_task_type = std::packaged_task<ArgTp()> |
Definition at line 102 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::promise_type = std::promise<ArgTp> |
Definition at line 100 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::result_type = Tp |
Definition at line 96 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::reverse_iterator = typename future_list_t::reverse_iterator |
Definition at line 106 of file TaskGroup.hh.
|
protected |
Definition at line 214 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::size_type = uintmax_t |
Definition at line 90 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::task_list_t = container_type<task_pointer> |
Definition at line 98 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::task_pointer = std::shared_ptr<TaskFuture<ArgTp> > |
Definition at line 97 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::task_type = Task<ArgTp, decay_t<Args>...> |
Definition at line 111 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::this_type = TaskGroup<Tp, Arg, MaxDepth> |
Definition at line 99 of file TaskGroup.hh.
using PTL::TaskGroup< Tp, Arg, MaxDepth >::tid_type = std::thread::id |
Definition at line 89 of file TaskGroup.hh.
PTL::TaskGroup< Tp, Arg, MaxDepth >::TaskGroup | ( | Func && | _join, |
ThreadPool * | _tp = internal::get_default_threadpool() |
||
) |
Definition at line 290 of file TaskGroup.hh.
PTL::TaskGroup< Tp, Arg, MaxDepth >::TaskGroup | ( | ThreadPool * | _tp = internal::get_default_threadpool() , |
enable_if_t< std::is_void< Up >::value, int > | = 0 |
||
) |
Definition at line 299 of file TaskGroup.hh.
PTL::TaskGroup< Tp, Arg, MaxDepth >::~TaskGroup |
Definition at line 309 of file TaskGroup.hh.
|
delete |
|
default |
|
inline |
Definition at line 227 of file TaskGroup.hh.
|
inline |
Definition at line 229 of file TaskGroup.hh.
|
inline |
Definition at line 231 of file TaskGroup.hh.
|
inline |
Definition at line 232 of file TaskGroup.hh.
void PTL::TaskGroup< Tp, Arg, MaxDepth >::clear |
Definition at line 708 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::clear().
|
inline |
Definition at line 228 of file TaskGroup.hh.
|
inline |
Definition at line 230 of file TaskGroup.hh.
enable_if_t< std::is_void< Up >::value, void > PTL::TaskGroup< Tp, Arg, MaxDepth >::exec | ( | Func | func, |
Args... | args | ||
) |
Definition at line 531 of file TaskGroup.hh.
Referenced by G4TaskRunManager::AddEventTask(), PTL::TaskManager::exec(), PTL::TaskManager::rexec(), and PTL::TaskGroup< Tp, Arg, MaxDepth >::run().
enable_if_t<!std::is_void< Up >::value, void > PTL::TaskGroup< Tp, Arg, MaxDepth >::exec | ( | Func | func, |
Args... | args | ||
) |
Definition at line 576 of file TaskGroup.hh.
ScopeDestructor PTL::TaskGroup< Tp, Arg, MaxDepth >::get_scope_destructor |
Definition at line 497 of file TaskGroup.hh.
|
inline |
Definition at line 221 of file TaskGroup.hh.
|
inline |
Definition at line 222 of file TaskGroup.hh.
|
inline |
Definition at line 158 of file TaskGroup.hh.
|
inline |
Definition at line 166 of file TaskGroup.hh.
|
inline |
Definition at line 165 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::wrap().
|
inline |
Definition at line 675 of file TaskGroup.hh.
|
inline |
|
inline |
Definition at line 654 of file TaskGroup.hh.
Referenced by G4TaskRunManager::TerminateWorkers(), and G4TaskRunManager::WaitForEndEventLoopWorkers().
|
protected |
Definition at line 623 of file TaskGroup.hh.
|
protected |
Definition at line 639 of file TaskGroup.hh.
void PTL::TaskGroup< Tp, Arg, MaxDepth >::notify |
Definition at line 514 of file TaskGroup.hh.
void PTL::TaskGroup< Tp, Arg, MaxDepth >::notify_all |
Definition at line 522 of file TaskGroup.hh.
|
inline |
Definition at line 145 of file TaskGroup.hh.
|
inline |
Definition at line 146 of file TaskGroup.hh.
std::shared_ptr< Up > PTL::TaskGroup< Tp, Arg, MaxDepth >::operator+= | ( | std::shared_ptr< Up > && | _task | ) |
Definition at line 332 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::wrap().
|
inline |
Definition at line 147 of file TaskGroup.hh.
|
inline |
Definition at line 148 of file TaskGroup.hh.
|
delete |
|
default |
|
inline |
Definition at line 169 of file TaskGroup.hh.
|
inline |
Definition at line 162 of file TaskGroup.hh.
|
inline |
Definition at line 163 of file TaskGroup.hh.
|
inline |
Definition at line 233 of file TaskGroup.hh.
|
inline |
Definition at line 235 of file TaskGroup.hh.
|
inline |
Definition at line 234 of file TaskGroup.hh.
|
inline |
Definition at line 236 of file TaskGroup.hh.
|
inline |
Definition at line 178 of file TaskGroup.hh.
|
inline |
Definition at line 199 of file TaskGroup.hh.
|
inline |
Definition at line 161 of file TaskGroup.hh.
|
inlinestatic |
Definition at line 171 of file TaskGroup.hh.
|
inline |
Definition at line 151 of file TaskGroup.hh.
|
inline |
Definition at line 155 of file TaskGroup.hh.
|
inlineprotected |
Definition at line 263 of file TaskGroup.hh.
|
inlineprotected |
Definition at line 264 of file TaskGroup.hh.
|
inline |
Definition at line 154 of file TaskGroup.hh.
|
inlinestaticprotected |
Definition at line 259 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::is_main().
void PTL::TaskGroup< Tp, Arg, MaxDepth >::wait |
Definition at line 344 of file TaskGroup.hh.
Referenced by G4TaskRunManager::CreateAndStartWorkers().
|
inline |
Definition at line 186 of file TaskGroup.hh.
Referenced by PTL::TaskManager::wrap().
|
staticprotected |
Definition at line 267 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::set_verbose().
|
protected |
Definition at line 270 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::wrap().
|
protected |
Definition at line 279 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::begin(), PTL::TaskGroup< Tp, Arg, MaxDepth >::cbegin(), PTL::TaskGroup< Tp, Arg, MaxDepth >::cend(), PTL::TaskGroup< Tp, Arg, MaxDepth >::end(), PTL::TaskGroup< Tp, Arg, MaxDepth >::get_tasks(), PTL::TaskGroup< Tp, Arg, MaxDepth >::rbegin(), PTL::TaskGroup< Tp, Arg, MaxDepth >::rend(), and PTL::TaskGroup< Tp, Arg, MaxDepth >::reserve().
|
protected |
Definition at line 269 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::id().
|
protected |
Definition at line 275 of file TaskGroup.hh.
|
protected |
Definition at line 271 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::is_main().
|
protected |
Definition at line 276 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::pool(), and PTL::TaskGroup< Tp, Arg, MaxDepth >::set_pool().
|
protected |
Definition at line 274 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::task_cond().
|
protected |
Definition at line 278 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::reserve().
|
protected |
Definition at line 273 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::task_lock().
|
protected |
Definition at line 277 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::is_native_task_group().
|
protected |
Definition at line 272 of file TaskGroup.hh.
Referenced by PTL::TaskGroup< Tp, Arg, MaxDepth >::operator++(), PTL::TaskGroup< Tp, Arg, MaxDepth >::operator--(), PTL::TaskGroup< Tp, Arg, MaxDepth >::pending(), PTL::TaskGroup< Tp, Arg, MaxDepth >::size(), and PTL::TaskGroup< Tp, Arg, MaxDepth >::task_count().