Nugget
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
psyqo::Coroutine< T >::ChainAwaiter Struct Reference

The awaiter type for coroutine-to-coroutine chaining via co_await. More...

#include <psyqo/coroutine.hh>

Public Member Functions

 ChainAwaiter (std::coroutine_handle< Promise > h)
 
 ~ChainAwaiter ()
 
 ChainAwaiter (ChainAwaiter &&other)
 
ChainAwaiteroperator= (ChainAwaiter &&)=delete
 
 ChainAwaiter (const ChainAwaiter &)=delete
 
ChainAwaiteroperator= (const ChainAwaiter &)=delete
 
constexpr bool await_ready ()
 
void await_suspend (std::coroutine_handle<> h)
 
constexpr T await_resume ()
 

Public Attributes

std::coroutine_handle< Promise > handle
 

Detailed Description

template<typename T = void>
struct psyqo::Coroutine< T >::ChainAwaiter

The awaiter type for coroutine-to-coroutine chaining via co_await.

GCC has known bugs across versions 10-15+ where the awaitable temporary in a co_await expression is not correctly promoted to the coroutine frame. By using operator co_await(), we transfer the coroutine handle to this awaiter object that GCC's coroutine pass reliably stores in the frame.

Constructor & Destructor Documentation

◆ ChainAwaiter() [1/3]

template<typename T = void>
psyqo::Coroutine< T >::ChainAwaiter::ChainAwaiter ( std::coroutine_handle< Promise >  h)
inlineexplicit

◆ ~ChainAwaiter()

template<typename T = void>
psyqo::Coroutine< T >::ChainAwaiter::~ChainAwaiter ( )
inline

◆ ChainAwaiter() [2/3]

template<typename T = void>
psyqo::Coroutine< T >::ChainAwaiter::ChainAwaiter ( ChainAwaiter &&  other)
inline

◆ ChainAwaiter() [3/3]

template<typename T = void>
psyqo::Coroutine< T >::ChainAwaiter::ChainAwaiter ( const ChainAwaiter )
delete

Member Function Documentation

◆ await_ready()

template<typename T = void>
constexpr bool psyqo::Coroutine< T >::ChainAwaiter::await_ready ( )
inlineconstexpr

◆ await_resume()

template<typename T = void>
constexpr T psyqo::Coroutine< T >::ChainAwaiter::await_resume ( )
inlineconstexpr

◆ await_suspend()

template<typename T = void>
void psyqo::Coroutine< T >::ChainAwaiter::await_suspend ( std::coroutine_handle<>  h)
inline

◆ operator=() [1/2]

template<typename T = void>
ChainAwaiter & psyqo::Coroutine< T >::ChainAwaiter::operator= ( ChainAwaiter &&  )
delete

◆ operator=() [2/2]

template<typename T = void>
ChainAwaiter & psyqo::Coroutine< T >::ChainAwaiter::operator= ( const ChainAwaiter )
delete

Member Data Documentation

◆ handle

template<typename T = void>
std::coroutine_handle<Promise> psyqo::Coroutine< T >::ChainAwaiter::handle

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