Zth (libzth)
Loading...
Searching...
No Matches
zth::coro::task< T > Class Template Reference

A coroutine task producing a single result value. More...

#include <coro.h>

Public Types

using return_type = T
 
using promise_type = task_promise< return_type >
 
using Future_type = typename promise_type::Future_type
 

Public Member Functions

 task (std::coroutine_handle< promise_type > h) noexcept
 
 task (zth::SharedPointer< promise_type > const &p) noexcept
 
 task (zth::SharedPointer< promise_type > &&p) noexcept
 
 task (promise_type *p=nullptr) noexcept
 
promise_typepromise () const noexcept
 
char const * id_str () const noexcept
 
void setName (string name) noexcept
 
bool completed () const noexcept
 
Future_typefuture () const
 
decltype(auto) result ()
 
decltype(auto) run ()
 
decltype(auto) operator() ()
 
decltype(auto) fiber (char const *name=nullptr)
 
auto & operator co_await () noexcept
 
bool await_ready () const noexcept
 
std::coroutine_handle< promise_typeawait_suspend (std::coroutine_handle<> h) noexcept
 
decltype(auto) await_resume ()
 

Detailed Description

template<typename T = void>
class zth::coro::task< T >

A coroutine task producing a single result value.

Template Parameters
TThe return type of the coroutine. Use void for no return value.
Examples
7_coro.cpp, and sock_factory.cpp.

Definition at line 515 of file coro.h.

Member Typedef Documentation

◆ Future_type

template<typename T = void>
using zth::coro::task< T >::Future_type = typename promise_type::Future_type

Definition at line 519 of file coro.h.

◆ promise_type

template<typename T = void>
using zth::coro::task< T >::promise_type = task_promise<return_type>

Definition at line 518 of file coro.h.

◆ return_type

template<typename T = void>
using zth::coro::task< T >::return_type = T

Definition at line 517 of file coro.h.

Constructor & Destructor Documentation

◆ task() [1/4]

template<typename T = void>
zth::coro::task< T >::task ( std::coroutine_handle< promise_type h)
inlineexplicitnoexcept

Definition at line 521 of file coro.h.

◆ task() [2/4]

template<typename T = void>
zth::coro::task< T >::task ( zth::SharedPointer< promise_type > const &  p)
inlineexplicitnoexcept

Definition at line 525 of file coro.h.

◆ task() [3/4]

template<typename T = void>
zth::coro::task< T >::task ( zth::SharedPointer< promise_type > &&  p)
inlineexplicitnoexcept

Definition at line 529 of file coro.h.

◆ task() [4/4]

template<typename T = void>
zth::coro::task< T >::task ( promise_type p = nullptr)
inlineexplicitnoexcept

Definition at line 533 of file coro.h.

Member Function Documentation

◆ await_ready()

template<typename T = void>
bool zth::coro::task< T >::await_ready ( ) const
inlinenoexcept

Definition at line 608 of file coro.h.

◆ await_resume()

template<typename T = void>
decltype(auto) zth::coro::task< T >::await_resume ( )
inline

Definition at line 621 of file coro.h.

◆ await_suspend()

template<typename T = void>
std::coroutine_handle< promise_type > zth::coro::task< T >::await_suspend ( std::coroutine_handle<>  h)
inlinenoexcept

Definition at line 613 of file coro.h.

◆ completed()

template<typename T = void>
bool zth::coro::task< T >::completed ( ) const
inlinenoexcept

Definition at line 555 of file coro.h.

◆ fiber()

template<typename T = void>
decltype(auto) zth::coro::task< T >::fiber ( char const *  name = nullptr)
inline

Definition at line 590 of file coro.h.

◆ future()

template<typename T = void>
Future_type & zth::coro::task< T >::future ( ) const
inline

Definition at line 561 of file coro.h.

◆ id_str()

template<typename T = void>
char const * zth::coro::task< T >::id_str ( ) const
inlinenoexcept

Definition at line 542 of file coro.h.

◆ operator co_await()

template<typename T = void>
auto & zth::coro::task< T >::operator co_await ( )
inlinenoexcept

Definition at line 603 of file coro.h.

◆ operator()()

template<typename T = void>
decltype(auto) zth::coro::task< T >::operator() ( )
inline

Definition at line 585 of file coro.h.

◆ promise()

template<typename T = void>
promise_type * zth::coro::task< T >::promise ( ) const
inlinenoexcept

Definition at line 537 of file coro.h.

◆ result()

template<typename T = void>
decltype(auto) zth::coro::task< T >::result ( )
inline

Definition at line 570 of file coro.h.

◆ run()

template<typename T = void>
decltype(auto) zth::coro::task< T >::run ( )
inline

Definition at line 575 of file coro.h.

◆ setName()

template<typename T = void>
void zth::coro::task< T >::setName ( string  name)
inlinenoexcept

Definition at line 548 of file coro.h.


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