ReXGlue SDK
Loading...
Searching...
No Matches
rex::platform::Fiber Struct Reference

#include <rex/platform/thread.h>

Public Member Functions

void Destroy ()

Static Public Member Functions

static Fiber * ConvertCurrentThread ()
static Fiber * Create (size_t stack_size, void(*entry)(void *), void *arg)
static void SwitchTo (Fiber *target)
static Fiber * GetCurrent ()

Detailed Description

Host OS fiber. Each guest fiber owns one Fiber. A switch keeps the whole C++ call stack.

Member Function Documentation

◆ ConvertCurrentThread()

Fiber * rex::platform::Fiber::ConvertCurrentThread ( )
static

Converts the calling thread into a fiber.

Returns
Fiber for the current execution context, or null on failure.

◆ Create()

Fiber * rex::platform::Fiber::Create ( size_t stack_size,
void(* entry )(void *),
void * arg )
static

Creates a fiber with its own host stack. The first switch to it calls entry(arg).

Returns
The new fiber, or null on failure.

◆ Destroy()

void rex::platform::Fiber::Destroy ( )

Destroys the fiber. A created fiber must not be running. A converted thread fiber is destroyed from its own thread and turns it back into a plain thread.

◆ GetCurrent()

Fiber * rex::platform::Fiber::GetCurrent ( )
static

Returns the fiber running on the calling thread, or null when the thread was never converted.

◆ SwitchTo()

void rex::platform::Fiber::SwitchTo ( Fiber * target)
static

Suspends the current fiber and resumes target. Returns when another fiber switches back.


The documentation for this struct was generated from the following file: