24 #ifndef LELY_UTIL_COROUTINE_HPP_ 25 #define LELY_UTIL_COROUTINE_HPP_ 33 #define co_restart(ctx) co_restart__(to_co_ctx(ctx)) 36 #define co_is_ready(ctx) co_is_ready__(to_co_ctx(ctx)) 39 #define co_reenter(ctx) co_reenter__(to_co_ctx(ctx)) 57 bool is_ready() const noexcept {
return ctx_.label == -1; }
63 bool is_child() const noexcept {
return ctx_.label < -1; }
77 #endif // !LELY_UTIL_COROUTINE_HPP_ This header file is part of the utilities libraru; it contains a stackless coroutine implementation...
#define co_restart(ctx)
Resets a stackless coroutine so the next invocation starts at the beginning.
The type holding the context (i.e., program counter) of a stackless coroutine.
The parent class for function objects used as stackless coroutines.
void restart() noexcept
Resets the stackless coroutine so the next invocation starts at the beginning.
bool is_parent() const noexcept
Returns true if the stackless coroutine is the parent of a fork.
bool is_child() const noexcept
Returns true if the stackless coroutine is the child of a fork.
bool is_ready() const noexcept
Returns true if the stackless coroutine has finished.