LuciadCPillar 2023.1.04
luciad::ITaskScheduler Class Referenceabstract

Interface for a class that can schedule tasks. More...

#include <luciad/concurrent/ITaskScheduler.h>

Public Member Functions

virtual ~ITaskScheduler ()=default
 
virtual void schedule (const std::shared_ptr< ITask > &task)=0
 Implement this method to execute the given ITask with the desired context. More...
 

Static Public Member Functions

static std::shared_ptr< ITaskSchedulercreate (std::function< void(const std::shared_ptr< ITask > &)> function)
 Creates a default ITaskScheduler instance that delegates the ITask handling to the given function. More...
 

Detailed Description

Interface for a class that can schedule tasks.

Tasks must implement the ITask interface. This allows a task consumer to run tasks on a specific thread if needed.

Constructor & Destructor Documentation

◆ ~ITaskScheduler()

virtual luciad::ITaskScheduler::~ITaskScheduler ( )
virtualdefault

Member Function Documentation

◆ create()

static std::shared_ptr< ITaskScheduler > luciad::ITaskScheduler::create ( std::function< void(const std::shared_ptr< ITask > &)>  function)
static

Creates a default ITaskScheduler instance that delegates the ITask handling to the given function.

This is a convenience method that allows to reduce boiler plate code, and use lambdas.

Parameters
functionthe function that is called to execute the ITask.
Returns
an ITaskScheduler instance based on the given function.

◆ schedule()

virtual void luciad::ITaskScheduler::schedule ( const std::shared_ptr< ITask > &  task)
pure virtual

Implement this method to execute the given ITask with the desired context.

Parameters
taskthe task to execute, cannot be nullptr.