Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
AMP::ThreadPool::WorkItemRet< return_type > Class Template Referenceabstract

Class to define a work item returning a variable. More...

#include <ThreadPool.h>

Inheritance diagram for AMP::ThreadPool::WorkItemRet< return_type >:
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.
 
return_type get_results () const
 Return the results.
 
auto getStatus () const
 Get the current status.
 
virtual bool has_result () const override final
 Will the routine return a result.
 
virtual void run () override=0
 Run the work item.
 
virtual ~WorkItemRet ()
 Virtual destructor.
 

Protected Member Functions

 WorkItemRet ()
 

Protected Attributes

return_type d_result
 

Private Member Functions

WorkItemRetoperator= (const WorkItemRet &)
 
 WorkItemRet (const WorkItemRet &)
 

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
 

Detailed Description

template<typename return_type>
class AMP::ThreadPool::WorkItemRet< return_type >

Class to define a work item returning a variable.

This is the class that defines a work item to be processed. Users may derive their own class and add work using the add_work routine, or can use the TPOOL_ADD_WORK macro. Note: this class is templated on the return argument type and may be a void type.

Definition at line 70 of file ThreadPool.h.

Constructor & Destructor Documentation

◆ ~WorkItemRet()

template<typename return_type >
virtual AMP::ThreadPool::WorkItemRet< return_type >::~WorkItemRet ( )
inlinevirtual

Virtual destructor.

Definition at line 80 of file ThreadPool.h.

◆ WorkItemRet() [1/2]

template<typename return_type >
AMP::ThreadPool::WorkItemRet< return_type >::WorkItemRet ( )
inlineprotected

Definition at line 84 of file ThreadPool.h.

◆ WorkItemRet() [2/2]

template<typename return_type >
AMP::ThreadPool::WorkItemRet< return_type >::WorkItemRet ( const WorkItemRet< return_type > &  )
private

Member Function Documentation

◆ add_dependencies() [1/2]

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

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 AMP::ThreadPoolWorkItem::add_dependencies().

Referenced by AMP::ThreadPoolWorkItem::add_dependencies(), and AMP::ThreadPoolWorkItem::add_dependency().

◆ add_dependencies() [2/2]

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

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)
inlineinherited

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 AMP::ThreadPoolWorkItem::add_dependencies().

◆ get_dependencies()

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

Return the list of work ids that we depend on.

◆ get_N_dependencies()

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

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

Definition at line 33 of file ThreadPoolWorkItem.h.

References AMP::ThreadPoolWorkItem::d_N_ids.

◆ get_results()

template<typename return_type >
return_type AMP::ThreadPool::WorkItemRet< return_type >::get_results ( ) const
inline

Return the results.

Definition at line 78 of file ThreadPool.h.

References AMP::ThreadPool::WorkItemRet< return_type >::d_result.

◆ getStatus()

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

Get the current status.

Definition at line 59 of file ThreadPoolWorkItem.h.

References AMP::ThreadPoolWorkItem::d_state.

◆ has_result()

template<typename return_type >
virtual bool AMP::ThreadPool::WorkItemRet< return_type >::has_result ( ) const
inlinefinaloverridevirtual

Will the routine return a result.

Implements AMP::ThreadPoolWorkItem.

Definition at line 76 of file ThreadPool.h.

◆ operator=()

template<typename return_type >
WorkItemRet & AMP::ThreadPool::WorkItemRet< return_type >::operator= ( const WorkItemRet< return_type > &  )
private

◆ run()

template<typename return_type >
virtual void AMP::ThreadPool::WorkItemRet< return_type >::run ( )
overridepure virtual

Run the work item.

Implements AMP::ThreadPoolWorkItem.

Member Data Documentation

◆ d_count

volatile std::atomic_int32_t AMP::ThreadPoolWorkItem::d_count
privateinherited

Definition at line 78 of file ThreadPoolWorkItem.h.

◆ d_ids

ThreadPoolID* AMP::ThreadPoolWorkItem::d_ids
privateinherited

Definition at line 79 of file ThreadPoolWorkItem.h.

Referenced by AMP::ThreadPoolWorkItem::~ThreadPoolWorkItem().

◆ d_N_ids

uint16_t AMP::ThreadPoolWorkItem::d_N_ids
privateinherited

◆ d_result

template<typename return_type >
return_type AMP::ThreadPool::WorkItemRet< return_type >::d_result
protected

◆ d_size

uint16_t AMP::ThreadPoolWorkItem::d_size
privateinherited

Definition at line 77 of file ThreadPoolWorkItem.h.

Referenced by AMP::ThreadPoolWorkItem::~ThreadPoolWorkItem().

◆ d_state

volatile ThreadPoolID::Status AMP::ThreadPoolWorkItem::d_state
privateinherited

Definition at line 75 of file ThreadPoolWorkItem.h.

Referenced by AMP::ThreadPoolWorkItem::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