![]() |
Spicy
|
#include <fiber.h>
Classes | |
struct | Statistics |
Public Types | |
enum | Type : int64_t { Type::IndividualStack, Type::SharedStack, Type::Main, Type::SwitchTrampoline } |
Public Member Functions | |
Fiber (Type type) | |
Fiber (const Fiber &)=delete | |
Fiber (Fiber &&)=delete | |
Fiber & | operator= (const Fiber &)=delete |
Fiber & | operator= (Fiber &&)=delete |
void | init (Lambda< hilti::rt::any(resumable::Handle *)> f) |
auto | type () |
const auto & | stackBuffer () const |
void | run () |
void | yield () |
void | resume () |
void | abort () |
bool | isMain () const |
bool | isDone () |
auto && | result () |
std::exception_ptr | exception () const |
std::string | tag () const |
Static Public Member Functions | |
static std::unique_ptr< Fiber > | create () |
static void | destroy (std::unique_ptr< Fiber > f) |
static void | primeCache () |
static void | reset () |
static Statistics | statistics () |
A fiber implements a co-routine that can at any time yield control back to its caller, to be resumed later. This is the internal class implementing the main functionality. It's used by Resumable
, which provides the external interface.
|
strong |
Type of fiber.
Enumerator | |
---|---|
IndividualStack | Fiver using a dedicated local stack (needs more memory, but switching is fast) |
SharedStack | Fiber sharing a global stack (needs less memory, but switching costs extra) |
Main | Pseudo-fiber for the top-level process; for internally use only |
SwitchTrampoline | Fiber representing a trampoline for stack switching; for internal use only |
|
inline |
Returns the fiber's stack buffer.
|
inline |
Returns the fiber's type.