Peano
Loading...
Searching...
No Matches
tarch::multicore::TaskWithoutCopyOfFunctor Class Reference

Frequently used implementation for job with a functor. More...

#include <Task.h>

Inheritance diagram for tarch::multicore::TaskWithoutCopyOfFunctor:
Collaboration diagram for tarch::multicore::TaskWithoutCopyOfFunctor:

Public Member Functions

 TaskWithoutCopyOfFunctor ()=delete
 TaskWithoutCopyOfFunctor (const TaskWithoutCopyOfFunctor &)=delete
 TaskWithoutCopyOfFunctor (int taskType, int priority, std::function< void()> &taskFunctor)
virtual void run () override
 Run the task.
Public Member Functions inherited from tarch::multicore::Task
 Task (int taskType, int priority)
 Construct task.
virtual ~Task ()
int getTaskType () const
int getPriority () const
void setPriority (int priority)
 Set priority.
virtual bool canFuse () const
virtual void fuse (const std::vector< Task * > &otherTasks, int targetDevice=Host)
 Fuse multiple tasks.
virtual std::string toString () const

Private Attributes

std::function< void()> & _taskFunctor
 See the outer class description for an explanation why this is an attribute, i.e.

Additional Inherited Members

Static Public Attributes inherited from tarch::multicore::Task
static constexpr int DefaultPriority = 1024
static constexpr int Host = -1
static constexpr int DontFuse = -1
Protected Attributes inherited from tarch::multicore::Task
const int _taskType
int _priority

Detailed Description

Frequently used implementation for job with a functor.

Cousin implementation to TaskWithCopyOfFunctor which does not copy the underlying functor but holds a reference to it. This implies that you have to ensure that the functor remains valid after you have spawned the task.

It can pay off to use this variant for very expensive functors, i.e. functors that internally copy a lot of things. In most cases, you won't need this class. I recommend to start with the copy version always.

Please consult TaskWithCopyOfFunctor for further information on the used attributes.

Definition at line 332 of file Task.h.

Constructor & Destructor Documentation

◆ TaskWithoutCopyOfFunctor() [1/3]

tarch::multicore::TaskWithoutCopyOfFunctor::TaskWithoutCopyOfFunctor ( )
delete

Referenced by TaskWithoutCopyOfFunctor().

Here is the caller graph for this function:

◆ TaskWithoutCopyOfFunctor() [2/3]

tarch::multicore::TaskWithoutCopyOfFunctor::TaskWithoutCopyOfFunctor ( const TaskWithoutCopyOfFunctor & )
delete

References TaskWithoutCopyOfFunctor().

Here is the call graph for this function:

◆ TaskWithoutCopyOfFunctor() [3/3]

tarch::multicore::TaskWithoutCopyOfFunctor::TaskWithoutCopyOfFunctor ( int taskType,
int priority,
std::function< void()> & taskFunctor )

Member Function Documentation

◆ run()

virtual void tarch::multicore::TaskWithoutCopyOfFunctor::run ( )
overridevirtual

Run the task.

Implements tarch::multicore::Task.

Field Documentation

◆ _taskFunctor

std::function<void()>& tarch::multicore::TaskWithoutCopyOfFunctor::_taskFunctor
private

See the outer class description for an explanation why this is an attribute, i.e.

why we copy the functor here always.

Definition at line 338 of file Task.h.


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