33 #ifndef LELY_UTIL_FIBER_H_
34 #define LELY_UTIL_FIBER_H_
47 #define FIBER_SAVE_MASK 0x1
52 #define FIBER_SAVE_FENV 0x2
58 #define FIBER_SAVE_ERROR 0x4
64 #if _POSIX_C_SOURCE >= 200112L
65 #if !_WIN32 && defined(__NEWLIB__)
66 #define FIBER_SAVE_ALL (FIBER_SAVE_MASK | FIBER_SAVE_ERROR)
68 #define FIBER_SAVE_ALL (FIBER_SAVE_MASK | FIBER_SAVE_FENV | FIBER_SAVE_ERROR)
71 #if !_WIN32 && defined(__NEWLIB__)
72 #define FIBER_SAVE_ALL FIBER_SAVE_ERROR
74 #define FIBER_SAVE_ALL (FIBER_SAVE_FENV | FIBER_SAVE_ERROR)
85 #define FIBER_GUARD_STACK 0x8
155 size_t data_size,
size_t stack_size);
This header file is part of the Lely libraries; it contains the compiler feature definitions.
void * fiber_data(const fiber_t *fiber)
Returns a pointer to the data region of the specified fiber, or of the calling fiber if fiber is NULL...
fiber_t * fiber_resume_with(fiber_t *fiber, fiber_func_t *func, void *arg)
Suspends the calling fiber and resumes the specified fiber, optionally executing a function before re...
int fiber_thrd_init(int flags)
Initializes the fiber associated with the calling thread.
fiber_t * fiber_resume(fiber_t *fiber)
Equivalent to fiber_resume_with(fiber, NULL, NULL).
void fiber_thrd_fini(void)
Finalizes the fiber associated with the calling thread.
fiber_t * fiber_func_t(fiber_t *fiber, void *arg)
The type of the function executed by a fiber.
void fiber_destroy(fiber_t *fiber)
Destroys the specified fiber.
fiber_t * fiber_create(fiber_func_t *func, void *arg, int flags, size_t data_size, size_t stack_size)
Creates a new fiber, allocates a stack and sets up a calling environment to begin executing the speci...
This header file is part of the C11 and POSIX compatibility library; it includes <stddef....
int flags
The flags provided to fiber_create().
void * arg
The second argument supplied to func.
fiber_func_t * func
A pointer to the function to be executed in the fiber.