![]() |
Spicy
|
#include <fiber.h>
Public Member Functions | |
| template<typename Function > | |
| Resumable (Function f) requires(std | |
| Resumable (const Resumable &r)=delete | |
| Resumable (Resumable &&r) noexcept=default | |
| Resumable & | operator= (const Resumable &other)=delete |
| Resumable & | operator= (Resumable &&other) noexcept=default |
| void | run () |
| void | resume () |
| void | abort () |
| resumable::Handle * | handle () |
| bool | hasResult () const |
| template<typename Result > | |
| const Result & | get () const |
| operator bool () const | |
Executor for a function that may yield control back to the caller even before it's finished. The caller can then later resume the function to continue its operation.
|
inline |
Creates an instance initialized with a function to execute. The function can then be started by calling run().
| f | function to be executed |
| void Resumable::abort | ( | ) |
When a function has yielded, abort its operation without resuming.
|
inline |
Returns the function's result once it has completed. Must not be called before completion; check with hasResult() first.
|
inline |
Returns a handle to the currently running function.
|
inline |
Returns true if the function has completed orderly and provided a result. If so, get() can be used to retrieve the result.
|
inlineexplicit |
Returns true if the function has completed.
| void Resumable::resume | ( | ) |
When a function has yielded, resumes its operation.
| void Resumable::run | ( | ) |
Starts execution of the function. This must be called only once.