#pragma once #include #include /*! \file fiber.h \brief The fiber-API is experimental and only supported on a few system. */ #ifdef __cplusplus extern "C" { #endif typedef struct kinc_fiber { kinc_fiber_impl_t impl; } kinc_fiber_t; /// /// Uses the current thread as a fiber. /// /// The fiber-object to initialize using the current thread KINC_FUNC void kinc_fiber_init_current_thread(kinc_fiber_t *fiber); /// /// Initializes a fiber. /// /// The fiber-object to initialize /// The function to be run in the fiber-context /// A parameter to be provided to the fiber-function when it starts running KINC_FUNC void kinc_fiber_init(kinc_fiber_t *fiber, void (*func)(void *param), void *param); /// /// Destroys a fiber. /// /// The fiber to destroy KINC_FUNC void kinc_fiber_destroy(kinc_fiber_t *fiber); /// /// Switch the current thread to a different fiber. /// /// The fiber to switch to KINC_FUNC void kinc_fiber_switch(kinc_fiber_t *fiber); #ifdef __cplusplus } #endif