joque
task orchestration library
joque::exec_coro Class Reference

Coroutine representing one execution of entire task set. More...

#include <exec_coro.hpp>

Classes

struct  promise_type
 

Public Member Functions

 exec_coro (std::coroutine_handle< promise_type > h)
 Constructed by the coroutine mechanism from withing the promise type. More...
 
 exec_coro (exec_coro &&other) noexcept
 Move swaps internal pointers. More...
 
exec_corooperator= (exec_coro &&other) noexcept
 
bool done () const
 Execution is done after coroutine finishes it's run. More...
 
std::optional< exec_recordresult ()
 Returns execution record with data on successfull run. More...
 
void tick ()
 Runs one iteration of the execution, either new task is executed or nothing happens due to all threads/resources being utilized. More...
 
std::optional< exec_recordrun (std::chrono::milliseconds period=std::chrono::milliseconds{ 5 })
 Blocks until coroutine finishes it's run, returns pointer to exec_record with exact same behavior as result. More...
 
 ~exec_coro ()
 Destroys the coroutine if any. More...
 

Detailed Description

Coroutine representing one execution of entire task set.

Constructor & Destructor Documentation

◆ exec_coro() [1/2]

joque::exec_coro::exec_coro ( std::coroutine_handle< promise_type h)

Constructed by the coroutine mechanism from withing the promise type.

◆ exec_coro() [2/2]

joque::exec_coro::exec_coro ( exec_coro &&  other)
noexcept

Move swaps internal pointers.

◆ ~exec_coro()

joque::exec_coro::~exec_coro ( )

Destroys the coroutine if any.

Member Function Documentation

◆ operator=()

exec_coro& joque::exec_coro::operator= ( exec_coro &&  other)
noexcept

◆ done()

bool joque::exec_coro::done ( ) const

Execution is done after coroutine finishes it's run.

◆ result()

std::optional< exec_record > joque::exec_coro::result ( )

Returns execution record with data on successfull run.

Returns empty otherwise. If exception was raised during the run, result will rethrow it.

◆ tick()

void joque::exec_coro::tick ( )

Runs one iteration of the execution, either new task is executed or nothing happens due to all threads/resources being utilized.

Does nothing after the execution finished.

◆ run()

std::optional< exec_record > joque::exec_coro::run ( std::chrono::milliseconds  period = std::chrono::milliseconds{ 5 })

Blocks until coroutine finishes it's run, returns pointer to exec_record with exact same behavior as result.

Parameters
periodTime between attempts to resume the coroutine

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