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

#include <VUserTaskQueue.hh>

+ Inheritance diagram for PTL::VUserTaskQueue:

Public Types

using task_pointer = std::shared_ptr<VTask>
 
using AtomicInt = std::atomic<intmax_t>
 
using size_type = uintmax_t
 
using function_type = std::function<void()>
 
using ThreadIdSet = std::set<ThreadId>
 

Public Member Functions

 VUserTaskQueue (intmax_t nworkers=-1)
 
virtual ~VUserTaskQueue ()=default
 
virtual task_pointer GetTask (intmax_t subq=-1, intmax_t nitr=-1)=0
 
virtual intmax_t InsertTask (task_pointer &&, ThreadData *=nullptr, intmax_t subq=-1) PTL_NO_SANITIZE_THREAD=0
 
virtual void Wait ()=0
 
virtual intmax_t GetThreadBin () const =0
 
virtual void resize (intmax_t)=0
 
virtual size_type size () const =0
 
virtual bool empty () const =0
 
virtual size_type bin_size (size_type bin) const =0
 
virtual bool bin_empty (size_type bin) const =0
 
virtual size_type true_size () const
 
virtual bool true_empty () const
 
virtual void ExecuteOnAllThreads (ThreadPool *tp, function_type f)=0
 
virtual void ExecuteOnSpecificThreads (ThreadIdSet tid_set, ThreadPool *tp, function_type f)=0
 
intmax_t workers () const
 
virtual VUserTaskQueueclone ()=0
 

Protected Attributes

intmax_t m_workers = 0
 

Detailed Description

Definition at line 45 of file VUserTaskQueue.hh.

Member Typedef Documentation

◆ AtomicInt

using PTL::VUserTaskQueue::AtomicInt = std::atomic<intmax_t>

Definition at line 49 of file VUserTaskQueue.hh.

◆ function_type

using PTL::VUserTaskQueue::function_type = std::function<void()>

Definition at line 51 of file VUserTaskQueue.hh.

◆ size_type

using PTL::VUserTaskQueue::size_type = uintmax_t

Definition at line 50 of file VUserTaskQueue.hh.

◆ task_pointer

using PTL::VUserTaskQueue::task_pointer = std::shared_ptr<VTask>

Definition at line 48 of file VUserTaskQueue.hh.

◆ ThreadIdSet

Definition at line 52 of file VUserTaskQueue.hh.

Constructor & Destructor Documentation

◆ VUserTaskQueue()

VUserTaskQueue::VUserTaskQueue ( intmax_t nworkers = -1)
explicit

Definition at line 38 of file VUserTaskQueue.cc.

39: m_workers(nworkers)
40{
41 if(m_workers < 0)
42 {
44 m_workers = (rm) ? rm->GetNumberOfThreads() + 1 // number of threads + 1
45 : (2 * std::thread::hardware_concurrency()) + 1;
46 // hyperthreads + 1
47 }
48}
virtual int GetNumberOfThreads() const
static TaskRunManager * GetMasterRunManager(bool useTBB=false)

◆ ~VUserTaskQueue()

virtual PTL::VUserTaskQueue::~VUserTaskQueue ( )
virtualdefault

Member Function Documentation

◆ bin_empty()

virtual bool PTL::VUserTaskQueue::bin_empty ( size_type bin) const
pure virtual

Implemented in PTL::UserTaskQueue.

◆ bin_size()

virtual size_type PTL::VUserTaskQueue::bin_size ( size_type bin) const
pure virtual

Implemented in PTL::UserTaskQueue.

◆ clone()

virtual VUserTaskQueue * PTL::VUserTaskQueue::clone ( )
pure virtual

Implemented in PTL::UserTaskQueue.

◆ empty()

virtual bool PTL::VUserTaskQueue::empty ( ) const
pure virtual

◆ ExecuteOnAllThreads()

virtual void PTL::VUserTaskQueue::ExecuteOnAllThreads ( ThreadPool * tp,
function_type f )
pure virtual

◆ ExecuteOnSpecificThreads()

virtual void PTL::VUserTaskQueue::ExecuteOnSpecificThreads ( ThreadIdSet tid_set,
ThreadPool * tp,
function_type f )
pure virtual

◆ GetTask()

virtual task_pointer PTL::VUserTaskQueue::GetTask ( intmax_t subq = -1,
intmax_t nitr = -1 )
pure virtual

◆ GetThreadBin()

virtual intmax_t PTL::VUserTaskQueue::GetThreadBin ( ) const
pure virtual

◆ InsertTask()

virtual intmax_t PTL::VUserTaskQueue::InsertTask ( task_pointer && ,
ThreadData * = nullptr,
intmax_t subq = -1 )
pure virtual

◆ resize()

virtual void PTL::VUserTaskQueue::resize ( intmax_t )
pure virtual

◆ size()

virtual size_type PTL::VUserTaskQueue::size ( ) const
pure virtual

Implemented in PTL::UserTaskQueue.

Referenced by true_size().

◆ true_empty()

virtual bool PTL::VUserTaskQueue::true_empty ( ) const
inlinevirtual

Reimplemented in PTL::UserTaskQueue.

Definition at line 94 of file VUserTaskQueue.hh.

94{ return empty(); }
virtual bool empty() const =0

◆ true_size()

virtual size_type PTL::VUserTaskQueue::true_size ( ) const
inlinevirtual

Reimplemented in PTL::UserTaskQueue.

Definition at line 93 of file VUserTaskQueue.hh.

93{ return size(); }
virtual size_type size() const =0

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

◆ Wait()

virtual void PTL::VUserTaskQueue::Wait ( )
pure virtual

Implemented in PTL::UserTaskQueue.

◆ workers()

intmax_t PTL::VUserTaskQueue::workers ( ) const
inline

Definition at line 102 of file VUserTaskQueue.hh.

102{ return m_workers; }

Referenced by PTL::UserTaskQueue::clone().

Member Data Documentation

◆ m_workers


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