Mercury Currency Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mce::detail::await_coroutine Struct Reference
Inheritance diagram for mce::detail::await_coroutine:
Inheritance graph
[legend]
Collaboration diagram for mce::detail::await_coroutine:
Collaboration graph
[legend]

Public Member Functions

template<typename... As>
 await_coroutine (std::shared_ptr< threadpool > &&t, std::shared_ptr< scheduler > &&s, As &&... as)
 
virtual void run ()
 Execute until thunk completes or yield() is called. More...
 
- Public Member Functions inherited from mce::coroutine
template<typename THUNK >
 coroutine (THUNK &&th)
 construct a coroutine from a thunk
 
template<typename StackAllocator , typename THUNK >
 coroutine (StackAllocator &&sa, THUNK &&th)
 construct a coroutine from a stack allocator and thunk
 
 coroutine (const coroutine &source)=delete
 
 coroutine (coroutine &&rhs) noexcept
 Move Constructor.
 
coroutineoperator= (const coroutine &rhs)=delete
 
coroutineoperator= (coroutine &&rhs) noexcept
 Move Assignment.
 
void yield ()
 Pause execution and return to run() caller. More...
 
bool complete ()
 Returns true if thunk is complete, else false since the coroutine yielded early.
 

Static Public Member Functions

template<typename... As>
static std::unique_ptr< coroutinemake (std::shared_ptr< threadpool > &&t, std::shared_ptr< scheduler > &&s, As &&... as)
 
- Static Public Member Functions inherited from mce::coroutine
template<typename Callable , typename... As>
static std::unique_ptr< coroutinemake (Callable &&cb, As &&... as)
 construct an allocated coroutine from a Callable and arguments More...
 

Public Attributes

std::shared_ptr< threadpooloriginal_threadpool
 
std::shared_ptr< scheduleroriginal_scheduler
 
std::unique_ptr< coroutineco
 

Member Function Documentation

◆ run()

virtual void mce::detail::await_coroutine::run ( )
inlinevirtual

Execute until thunk completes or yield() is called.

Execute until thunk completes or yield() is called. If thunk is complete run() returns immediately.

This operation is virtual to allow for code injection at run() call.

Reimplemented from mce::coroutine.


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