Pigweed
 
Loading...
Searching...
No Matches
pw::async::Task Class Referencefinal

#include <task.h>

Public Member Functions

 Task ()
 
 Task (TaskFunction &&f)
 Constructs a Task that calls f when executed on a Dispatcher.
 
 Task (const Task &)=delete
 
Taskoperator= (const Task &)=delete
 
 Task (Task &&)=delete
 
Taskoperator= (Task &&)=delete
 
void set_function (TaskFunction &&f)
 
void operator() (Context &ctx, Status status)
 Executes this task.
 
backend::NativeTask & native_type ()
 
const backend::NativeTask & native_type () const
 

Detailed Description

A Task represents a unit of work (TaskFunction) that can be executed on a Dispatcher. To support various Dispatcher backends, it wraps a backend::NativeTask, which contains backend-specific state and methods.

Constructor & Destructor Documentation

◆ Task()

pw::async::Task::Task ( )
inline

The default constructor creates a Task without a function. set_function() must be called before posting the Task.

Member Function Documentation

◆ native_type()

backend::NativeTask & pw::async::Task::native_type ( )
inline

Returns the inner NativeTask containing backend-specific state. Only Dispatcher backends or non-portable code should call these methods!

◆ set_function()

void pw::async::Task::set_function ( TaskFunction &&  f)
inline

Configure the TaskFunction after construction. This MUST NOT be called while this Task is pending in a Dispatcher.


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