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))
62 return ctx_.label == -1;
74 return ctx_.label < -1;
85 to_co_ctx(Coroutine& coro) noexcept {
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_ready() const noexcept
Returns true if the stackless coroutine has finished.
bool is_child() const noexcept
Returns true if the stackless coroutine is the child of a fork.
bool is_parent() const noexcept
Returns true if the stackless coroutine is the parent of a fork.
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.