Welcome to TinyFiber’s documentation!

Indices and tables

Reference documentation

struct TfbJobDeclaration
#include <tinyfiber.h>

Public Members

void (*func)(void*)
void *user_data
TfbWaitHandle *wait_handle
struct TfbWaitHandle
#include <tinyfiber.h>

Public Members

ucontext_t *_fiber
std::atomic_int64_t _counter
std::mutex _lock
file tinyfiber.h
#include <stdint.h>
#include <stddef.h>
#include <atomic>
#include <mutex>
#include <optional>
#include <ucontext.h>

Typedefs

typedef struct TfbContext TfbContext

Functions

int tfb_init_ext(int max_threads)

Creates a new fiber system context.

TfbContext* fiber_system = NULL;
tfb_init_ext(&fiber_system, TFB_ALL_CORES);
tfb_free_ext&fiber_system);

See also

tfb_init()

See also

rfb_free_ext()

Parameters
  • fiber_system – is your in-out pointer to a TfbContext pointer. Initialize to NULL before use.

  • max_threads – descibes how many working threads your fiber system should have.

Returns

0 if successful, otherwise the error code.

inline int tfb_init()
int tfb_free()
int tfb_add_jobdecl(TfbJobDeclaration *job_declaration)
int tfb_add_jobdecls(TfbJobDeclaration jobs[], int64_t elements)
inline int tfb_add_job(void (*func)(void*), void *user_data, TfbWaitHandle *wh)
int tfb_await(TfbWaitHandle *wait_handle)
int64_t tfb_thread_id()

Variables

const int TFB_ALL_CORES = 0
dir /home/docs/checkouts/readthedocs.org/user_builds/tinyfiber/checkouts/latest/src