CAPD::DynSys Library  6.0.0
capd::threading::Task Class Referenceabstract

This class is an abstract Task to be executed in a thread pool. More...

#include <capd/threading/ThreadPool.h>

Public Types

typedef std::unique_lock< std::mutex > Lock
 

Public Member Functions

 Task (const Task &)=delete
 
 Task ()
 
virtual ~Task ()
 
virtual void run (unsigned threadId)=0
 
void join ()
 wait for task completion More...
 
void execute (unsigned threadId)
 This method can be invoked by the user but it is recomended to run tasks through a ThreadPool instance. More...
 

Static Public Member Functions

template<class F >
static LambdaTask< F > * createFromLambda (F &f)
 

Detailed Description

This class is an abstract Task to be executed in a thread pool.

An inheriting class should override the method run which will be exectued in the task.

An instance of processed task should exists until the thread pool to which the task is submitted completes the executon of the task or until the pool has been interrupted. Otherwise the behaviour is undefined.

Member Typedef Documentation

◆ Lock

typedef std::unique_lock<std::mutex> capd::threading::Task::Lock

Constructor & Destructor Documentation

◆ Task() [1/2]

capd::threading::Task::Task ( const Task )
delete

◆ Task() [2/2]

capd::threading::Task::Task ( )
inline

◆ ~Task()

virtual capd::threading::Task::~Task ( )
inlinevirtual

Member Function Documentation

◆ execute()

void capd::threading::Task::execute ( unsigned  threadId)
inline

This method can be invoked by the user but it is recomended to run tasks through a ThreadPool instance.

◆ join()

void capd::threading::Task::join ( )
inline

wait for task completion

◆ run()

virtual void capd::threading::Task::run ( unsigned  threadId)
pure virtual

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