API Documentation
Public Member Functions | List of all members
nkTasks::LambdaSchedulerTask Class Reference

Utility scheduler task using lambda functions to work. More...

Inheritance diagram for nkTasks::LambdaSchedulerTask:
nkTasks::SchedulerTask nkTasks::Task

Public Member Functions

 LambdaSchedulerTask () noexcept
 
 LambdaSchedulerTask (std::function< void()> asyncWorkFunction, std::function< void()> syncFunction) noexcept
 
virtual ~LambdaSchedulerTask ()
 
void setAsyncWorkFunction (std::function< void()> value)
 
void setSyncFunction (std::function< void()> value)
 
virtual void onAsyncWork () override
 
virtual void onSync () override
 
- Public Member Functions inherited from nkTasks::SchedulerTask
 SchedulerTask () noexcept
 
virtual ~SchedulerTask ()
 
- Public Member Functions inherited from nkTasks::Task
 Task () noexcept
 
virtual ~Task ()
 

Detailed Description

Utility scheduler task using lambda functions to work.

Constructor & Destructor Documentation

◆ LambdaSchedulerTask() [1/2]

nkTasks::LambdaSchedulerTask::LambdaSchedulerTask ( )
noexcept

Constructor.

◆ LambdaSchedulerTask() [2/2]

nkTasks::LambdaSchedulerTask::LambdaSchedulerTask ( std::function< void()>  asyncWorkFunction,
std::function< void()>  syncFunction 
)
noexcept

Callback constructor.

Parameters
asyncWorkFunctionThe callback to call during work.
syncFunctionThe callback to call during synchronization.

◆ ~LambdaSchedulerTask()

virtual nkTasks::LambdaSchedulerTask::~LambdaSchedulerTask ( )
virtual

Destructor.

Member Function Documentation

◆ setAsyncWorkFunction()

void nkTasks::LambdaSchedulerTask::setAsyncWorkFunction ( std::function< void()>  value)

Sets the callback method to be called during the task work.

Parameters
valueThe function to call.

◆ setSyncFunction()

void nkTasks::LambdaSchedulerTask::setSyncFunction ( std::function< void()>  value)

Sets the callback method to be called during the task synchronization.

Parameters
valueThe function to call.

◆ onAsyncWork()

virtual void nkTasks::LambdaSchedulerTask::onAsyncWork ( )
overridevirtual

Callback for the work that the task needs to do. This will be called in the thread the task has been assigned to.

Implements nkTasks::Task.

◆ onSync()

virtual void nkTasks::LambdaSchedulerTask::onSync ( )
overridevirtual

Method called during synchronization, after the task's asynchronous work has been done. The call happens during the call to Scheduler::tick when a task is marked as ready.

Implements nkTasks::SchedulerTask.


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