Tomographer  v5.3
Tomographer C++ Framework Documentation
Tomographer::MultiProc::ThreadCommon::TaskDispatcherBase< TaskType_, TaskCountIntType_ > Class Template Reference

Provide common functionality to thread-based MultiProc implementations. More...

#include <tomographer/multiprocthreadcommon.h>

+ Inheritance diagram for Tomographer::MultiProc::ThreadCommon::TaskDispatcherBase< TaskType_, TaskCountIntType_ >:

Classes

struct  TaskInterruptedInnerException
 
struct  ThreadPrivateData
 thread-local variables and stuff — also serves as TaskManagerIface More...
 
struct  ThreadSharedData
 thread-shared variables More...
 

Public Types

typedef TaskType_ TaskType
 The task type.
 
typedef TaskCountIntType_ TaskCountIntType
 Integer type used to count the number of tasks to run (or running)
 
typedef TaskType::ResultType TaskResultType
 The task result type.
 
typedef TaskType::StatusReportType TaskStatusReportType
 The type used by a single task when providing a status report.
 
typedef FullStatusReport< TaskStatusReportType, TaskCountIntTypeFullStatusReportType
 The type to use to generate a full status report of all running tasks.
 
typedef std::function< void(const FullStatusReportType &)> FullStatusReportCallbackType
 The relevant type for a callback function (or callable) which is provided with the full status report. More...
 

Protected Types

typedef std::chrono::steady_clock StdClockType
 

Protected Member Functions

 TaskDispatcherBase ()
 Basic constructor. More...
 
 TaskDispatcherBase (TaskDispatcherBase &&)
 
template<typename ThreadPrivateDataType , typename ThreadSharedDataType >
void run_worker_enter (ThreadPrivateDataType &private_data, ThreadSharedDataType &shared_data)
 New worker in the game.
 
template<typename ThreadPrivateDataType , typename ThreadSharedDataType >
void run_worker_exit (ThreadPrivateDataType &private_data, ThreadSharedDataType &shared_data)
 A worker exits the game.
 
template<typename ThreadPrivateDataType , typename ThreadSharedDataType >
void TOMOGRAPHER_CXX_STACK_FORCE_REALIGN run_task (ThreadPrivateDataType &private_data, ThreadSharedDataType &shared_data)
 Run a given task. More...
 
template<typename ThreadPrivateDataType , typename ThreadSharedDataType >
void master_continue_monitoring_status (ThreadPrivateDataType &private_data, ThreadSharedDataType &shared_data)
 To be called by master thread only to continue monitoring for status reports.
 
template<typename ThreadSharedDataType , typename LocalLoggerType >
void run_epilog (ThreadSharedDataType &shared_data, LocalLoggerType &llogger)
 To be called after all workers are done, to e.g. throw proper exception if an error occurred.
 

Detailed Description

template<typename TaskType_, typename TaskCountIntType_ = int>
class Tomographer::MultiProc::ThreadCommon::TaskDispatcherBase< TaskType_, TaskCountIntType_ >

Provide common functionality to thread-based MultiProc implementations.

Since
This class was introduced in Tomographer 5.2

See also Tomographer::MultiProc::CxxThreads, Tomographer::MultiProc::OMP.

  • TaskType must be a Task Interface compliant type. This type specifies the task which has to be run. Objects of this type will be instantiated within separate threads to run the tasks.

  • TaskCountIntType should be a type to use to count the number of tasks. Usually there's no reason not to use an int.

    NOTE: TaskCountIntType must be a signed integer type, because we might need to set the special value -1

Definition at line 98 of file multiprocthreadcommon.h.

Member Typedef Documentation

§ FullStatusReportCallbackType

template<typename TaskType_ , typename TaskCountIntType_ = int>
typedef std::function<void(const FullStatusReportType&)> Tomographer::MultiProc::ThreadCommon::TaskDispatcherBase< TaskType_, TaskCountIntType_ >::FullStatusReportCallbackType

The relevant type for a callback function (or callable) which is provided with the full status report.

This is the type used as argument to a subclass' setStatusReportHandler() method (see TaskDispatcher Interface).

Definition at line 120 of file multiprocthreadcommon.h.

Constructor & Destructor Documentation

§ TaskDispatcherBase()

template<typename TaskType_ , typename TaskCountIntType_ = int>
Tomographer::MultiProc::ThreadCommon::TaskDispatcherBase< TaskType_, TaskCountIntType_ >::TaskDispatcherBase ( )
inlineprotected

Basic constructor.

Definition at line 502 of file multiprocthreadcommon.h.

Member Function Documentation

§ run_task()

template<typename TaskType_ , typename TaskCountIntType_ = int>
template<typename ThreadPrivateDataType , typename ThreadSharedDataType >
void TOMOGRAPHER_CXX_STACK_FORCE_REALIGN Tomographer::MultiProc::ThreadCommon::TaskDispatcherBase< TaskType_, TaskCountIntType_ >::run_task ( ThreadPrivateDataType &  private_data,
ThreadSharedDataType &  shared_data 
)
inlineprotected

Run a given task.

Definition at line 570 of file multiprocthreadcommon.h.


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