C/C++ API Reference
Loading...
Searching...
No Matches
pw::async2::FallibleCoroTask< T, AllocationErrorHandler, ReturnValuePolicy::kDiscard > Class Template Referencefinal

Overview

template<typename T, typename AllocationErrorHandler>
class pw::async2::FallibleCoroTask< T, AllocationErrorHandler, ReturnValuePolicy::kDiscard >

FallibleCoroTask specialization that discards the coroutine's return value.

Inheritance diagram for pw::async2::FallibleCoroTask< T, AllocationErrorHandler, ReturnValuePolicy::kDiscard >:
pw::async2::Task pw::IntrusiveQueue< T >::Item pw::async2::Context

Public Member Functions

 FallibleCoroTask (Coro< T > &&coro, AllocationErrorHandler &&error_handler)
 
 FallibleCoroTask (const FallibleCoroTask &)=delete
 
FallibleCoroTaskoperator= (const FallibleCoroTask &)=delete
 
 FallibleCoroTask (FallibleCoroTask &&)=delete
 
FallibleCoroTaskoperator= (FallibleCoroTask &&)=delete
 
bool ok () const
 
- Public Member Functions inherited from pw::async2::Task
constexpr Task (log::Token name=kDefaultName)
 
 Task (const Task &)=delete
 
 Task (Task &&)=delete
 
Taskoperator= (const Task &)=delete
 
Taskoperator= (Task &&)=delete
 
virtual ~Task ()
 
Poll Pend (Context &cx)
 
bool IsRegistered () const
 
void Deregister ()
 
void Join ()
 

Private Member Functions

Poll DoPend (Context &cx) final
 

Additional Inherited Members

- Protected Types inherited from pw::async2::Task
using Context = ::pw::async2::Context
 

Member Function Documentation

◆ DoPend()

template<typename T , typename AllocationErrorHandler >
Poll pw::async2::FallibleCoroTask< T, AllocationErrorHandler, ReturnValuePolicy::kDiscard >::DoPend ( Context )
inlinefinalprivatevirtual

Attempts to advance this Task to completion.

This method should not perform synchronous waiting, as doing so may block the main Dispatcher loop and prevent other Task s from progressing. Because of this, Task s should not invoke blocking Dispatcher methods such as RunUntilComplete.

Tasks should also avoid invoking RunUntilStalled on their own Dispatcher.

Returns Ready if complete, or Pending if the Task was not yet able to complete.

If Pending is returned, the Task must ensure it is woken up when it is able to make progress. To do this, Task::Pend must arrange for Waker::Wake to be called, either by storing a copy of the Waker away to be awoken by another system (such as an interrupt handler).

Implements pw::async2::Task.

◆ ok()

template<typename T , typename AllocationErrorHandler >
bool pw::async2::FallibleCoroTask< T, AllocationErrorHandler, ReturnValuePolicy::kDiscard >::ok ( ) const
inline

Returns whether this FallibleCoroTask wraps a valid Coro and can be pended. Pending a !ok() FallibleCoroTask calls the error handler.

This will be false if Coro allocation failed.


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