Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
PTL::ThreadData Class Reference

#include <ThreadData.hh>

Public Types

template<typename Tp >
using TaskStack = std::deque<Tp>
 

Public Member Functions

 ThreadData (ThreadPool *tp)
 
 ~ThreadData ()=default
 
void update ()
 

Static Public Member Functions

static ThreadData *& GetInstance ()
 

Public Attributes

bool is_main = false
 
bool within_task = false
 
intmax_t task_depth = 0
 
ThreadPoolthread_pool = nullptr
 
VUserTaskQueuecurrent_queue = nullptr
 
TaskStack< VUserTaskQueue * > queue_stack = {}
 

Detailed Description

Definition at line 136 of file ThreadData.hh.

Member Typedef Documentation

◆ TaskStack

template<typename Tp >
using PTL::ThreadData::TaskStack = std::deque<Tp>

Definition at line 140 of file ThreadData.hh.

Constructor & Destructor Documentation

◆ ThreadData()

ThreadData::ThreadData ( ThreadPool * tp)

Definition at line 40 of file ThreadData.cc.

41: is_main((tp) ? tp->is_main() : false)
42, thread_pool(tp)
43, current_queue((tp) ? tp->get_queue() : nullptr)
45{}
VUserTaskQueue * current_queue
TaskStack< VUserTaskQueue * > queue_stack
ThreadPool * thread_pool

◆ ~ThreadData()

PTL::ThreadData::~ThreadData ( )
default

Member Function Documentation

◆ GetInstance()

ThreadData *& ThreadData::GetInstance ( )
static

Definition at line 32 of file ThreadData.cc.

33{
34 static thread_local ThreadData* _instance = nullptr;
35 return _instance;
36}

Referenced by PTL::UserTaskQueue::ExecuteOnAllThreads(), PTL::UserTaskQueue::ExecuteOnSpecificThreads(), PTL::internal::get_task_depth(), and PTL::ThreadPool::insert().

◆ update()

void ThreadData::update ( )

Definition at line 50 of file ThreadData.cc.

51{
52 if(!thread_pool)
53 return;
55 queue_stack.push_back(current_queue);
56}
task_queue_t * get_queue() const

Referenced by PTL::ThreadPool::execute_thread().

Member Data Documentation

◆ current_queue

VUserTaskQueue* PTL::ThreadData::current_queue = nullptr

◆ is_main

bool PTL::ThreadData::is_main = false

Definition at line 148 of file ThreadData.hh.

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

◆ queue_stack

TaskStack<VUserTaskQueue*> PTL::ThreadData::queue_stack = {}

Definition at line 153 of file ThreadData.hh.

153{};

Referenced by update().

◆ task_depth

intmax_t PTL::ThreadData::task_depth = 0

Definition at line 150 of file ThreadData.hh.

Referenced by PTL::internal::get_task_depth().

◆ thread_pool

ThreadPool* PTL::ThreadData::thread_pool = nullptr

Definition at line 151 of file ThreadData.hh.

Referenced by update(), and PTL::TaskGroup< Tp, Arg, MaxDepth >::wait().

◆ within_task

bool PTL::ThreadData::within_task = false

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