Spicy
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
hilti::rt::detail::Fiber Class Reference

#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
 
Fiberoperator= (const Fiber &)=delete
 
Fiberoperator= (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< Fibercreate ()
 
static void destroy (std::unique_ptr< Fiber > f)
 
static void primeCache ()
 
static void reset ()
 
static Statistics statistics ()
 

Detailed Description

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.

Member Enumeration Documentation

◆ Type

enum hilti::rt::detail::Fiber::Type : int64_t
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

Member Function Documentation

◆ stackBuffer()

const auto& hilti::rt::detail::Fiber::stackBuffer ( ) const
inline

Returns the fiber's stack buffer.

◆ type()

auto hilti::rt::detail::Fiber::type ( )
inline

Returns the fiber's type.


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