A Task that the Dispatcher takes ownership of when it is posted.
OwnedTask adds a virtual DoDestroy() function. This function is called by the dispatcher after the task completes. DoDestroy() must destroy the task and deallocate its memory.
After it is posted to a dispatcher, an OwnedTask may only be accessed from the dispatcher via the Task::DoPend() implementation.
Protected Member Functions | |
| constexpr | OwnedTask (log::Token name=kDefaultName) |
Protected Member Functions inherited from pw::containers::future::IntrusiveList< T >::Item | |
| constexpr | Item ()=default |
Private Member Functions | |
| virtual void | DoDestroy ()=0 |
Additional Inherited Members | |
Public Member Functions inherited from pw::async2::Task | |
| constexpr | Task (log::Token name=kDefaultName) |
| Task (const Task &)=delete | |
| Task (Task &&)=delete | |
| Task & | operator= (const Task &)=delete |
| Task & | operator= (Task &&)=delete |
| virtual | ~Task () |
| Poll | Pend (Context &cx) |
| bool | IsRegistered () const |
| void | Deregister () |
| void | Join () |
|
privatepure virtual |
The DoDestroy implementation must destroy this task and free its memory.
DoDestroy is normally invoked by a Dispatcher after a Posted OwnedTask completes.
This function is currently private, but potentially could be used by a Tasks delegating to other OwnedTasks.
Implemented in pw::async2::internal::AllocatedTask< Pendable >, and pw::async2::internal::RunHeapFuncTask< Func >.