16#include "pw_allocator/allocator.h"
17#include "pw_async2/dispatcher.h"
22template <
typename Pendable>
25 template <
typename... Args>
26 AllocatedTask(pw::allocator::Deallocator& deallocator, Args&&... args)
27 : deallocator_(deallocator), pendable_(std::forward<Args>(args)...) {}
32 void DoDestroy() final { deallocator_.Delete(
this); }
34 pw::allocator::Deallocator& deallocator_;
46template <
typename Pendable>
48 return allocator.
New<internal::AllocatedTask<Pendable>>(
49 allocator, std::forward<Pendable>(pendable));
58template <
typename Pendable,
typename... Args>
60 return allocator.
New<internal::AllocatedTask<Pendable>>(
61 allocator, std::forward<Args>(args)...);
Definition: allocator.h:34
std::enable_if_t<!std::is_array_v< T >, T * > New(Args &&... args)
Definition: allocator.h:57
Definition: dispatcher_base.h:52
Definition: dispatcher_base.h:158
Definition: allocate_task.h:23
Poll DoPend(Context &cx) final
Definition: allocate_task.h:30
void DoDestroy() final
Definition: allocate_task.h:32