Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
AMP::ThreadPoolWorkItem Class Referenceabstract

Base class for the work item (users should derive from ThreadPool::WorkItemRet) More...

#include <ThreadPoolWorkItem.h>

Inheritance diagram for AMP::ThreadPoolWorkItem:
Inheritance graph
[legend]

Public Member Functions

void add_dependencies (const std::vector< ThreadPoolID > &ids)
 Add a list of work item to the list of dependencies.
 
void add_dependencies (std::size_t N, const ThreadPoolID *ids)
 Add a list of work item to the list of dependencies Note: this function is thread-safe for the threadpool and does not need blocking.
 
void add_dependency (const ThreadPoolID &id)
 Add a work item to the list of dependencies.
 
std::vector< ThreadPoolIDget_dependencies () const
 Return the list of work ids that we depend on.
 
std::size_t get_N_dependencies () const
 Get the number of work ids that this work item depends on.
 
auto getStatus () const
 Get the current status.
 
virtual bool has_result () const =0
 Will the routine return a result.
 
virtual void run ()=0
 Function to run the routine.
 
virtual ~ThreadPoolWorkItem ()
 Empty deconstructor.
 

Protected Member Functions

 ThreadPoolWorkItem ()
 

Private Member Functions

ThreadPoolWorkItemoperator= (const ThreadPoolWorkItem &)=delete
 
 ThreadPoolWorkItem (const ThreadPoolWorkItem &)=delete
 

Private Attributes

volatile std::atomic_int32_t d_count
 
ThreadPoolIDd_ids
 
uint16_t d_N_ids
 
uint16_t d_size
 
volatile ThreadPoolID::Status d_state
 

Friends

class ThreadPool
 
class ThreadPoolID
 

Detailed Description

Base class for the work item (users should derive from ThreadPool::WorkItemRet)

Definition at line 17 of file ThreadPoolWorkItem.h.

Constructor & Destructor Documentation

◆ ~ThreadPoolWorkItem()

virtual AMP::ThreadPoolWorkItem::~ThreadPoolWorkItem ( )
inlinevirtual

Empty deconstructor.

Definition at line 25 of file ThreadPoolWorkItem.h.

References d_ids, d_N_ids, and d_size.

◆ ThreadPoolWorkItem() [1/2]

AMP::ThreadPoolWorkItem::ThreadPoolWorkItem ( )
inlineprotected

Definition at line 63 of file ThreadPoolWorkItem.h.

◆ ThreadPoolWorkItem() [2/2]

AMP::ThreadPoolWorkItem::ThreadPoolWorkItem ( const ThreadPoolWorkItem )
privatedelete

Member Function Documentation

◆ add_dependencies() [1/2]

void AMP::ThreadPoolWorkItem::add_dependencies ( const std::vector< ThreadPoolID > &  ids)
inline

Add a list of work item to the list of dependencies.

Parameters
idsIds of the work item to add

Definition at line 45 of file ThreadPoolWorkItem.h.

References add_dependencies().

Referenced by add_dependencies(), and add_dependency().

◆ add_dependencies() [2/2]

void AMP::ThreadPoolWorkItem::add_dependencies ( std::size_t  N,
const ThreadPoolID ids 
)

Add a list of work item to the list of dependencies Note: this function is thread-safe for the threadpool and does not need blocking.

Parameters
NNumber of items to add
idsIds of the work item to add

◆ add_dependency()

void AMP::ThreadPoolWorkItem::add_dependency ( const ThreadPoolID id)
inline

Add a work item to the list of dependencies.

Parameters
idId of the work item to add

Definition at line 40 of file ThreadPoolWorkItem.h.

References add_dependencies().

◆ get_dependencies()

std::vector< ThreadPoolID > AMP::ThreadPoolWorkItem::get_dependencies ( ) const

Return the list of work ids that we depend on.

◆ get_N_dependencies()

std::size_t AMP::ThreadPoolWorkItem::get_N_dependencies ( ) const
inline

Get the number of work ids that this work item depends on.

Definition at line 33 of file ThreadPoolWorkItem.h.

References d_N_ids.

◆ getStatus()

auto AMP::ThreadPoolWorkItem::getStatus ( ) const
inline

Get the current status.

Definition at line 59 of file ThreadPoolWorkItem.h.

References d_state.

◆ has_result()

virtual bool AMP::ThreadPoolWorkItem::has_result ( ) const
pure virtual

Will the routine return a result.

Implemented in AMP::ThreadPool::WorkItemRet< return_type >.

◆ operator=()

ThreadPoolWorkItem & AMP::ThreadPoolWorkItem::operator= ( const ThreadPoolWorkItem )
privatedelete

◆ run()

virtual void AMP::ThreadPoolWorkItem::run ( )
pure virtual

Function to run the routine.

Implemented in AMP::ThreadPool::WorkItemRet< return_type >.

Friends And Related Symbol Documentation

◆ ThreadPool

friend class ThreadPool
friend

Definition at line 62 of file ThreadPoolWorkItem.h.

◆ ThreadPoolID

friend class ThreadPoolID
friend

Definition at line 81 of file ThreadPoolWorkItem.h.

Member Data Documentation

◆ d_count

volatile std::atomic_int32_t AMP::ThreadPoolWorkItem::d_count
private

Definition at line 78 of file ThreadPoolWorkItem.h.

◆ d_ids

ThreadPoolID* AMP::ThreadPoolWorkItem::d_ids
private

Definition at line 79 of file ThreadPoolWorkItem.h.

Referenced by ~ThreadPoolWorkItem().

◆ d_N_ids

uint16_t AMP::ThreadPoolWorkItem::d_N_ids
private

Definition at line 76 of file ThreadPoolWorkItem.h.

Referenced by get_N_dependencies(), and ~ThreadPoolWorkItem().

◆ d_size

uint16_t AMP::ThreadPoolWorkItem::d_size
private

Definition at line 77 of file ThreadPoolWorkItem.h.

Referenced by ~ThreadPoolWorkItem().

◆ d_state

volatile ThreadPoolID::Status AMP::ThreadPoolWorkItem::d_state
private

Definition at line 75 of file ThreadPoolWorkItem.h.

Referenced by getStatus().


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page