Usage
You will learn the usage of fibers in this lesson.
We'll cover the following
Common operations of fibers
The following are common operations of fibers.
-
A fiber starts its execution from a callable entity (function pointer, delegate, etc.) that does not take any parameter and does not return anything. For example, the following function can be used as a fiber function:
void fiberFunction() { // ... }
-
A
fiber
can be created as an object ofcore.thread.Fiber
class with a callable entity:import core.thread; // ... auto fiber = new Fiber(&fiberFunction);
Alternatively, a subclass of
Fiber
can be defined, and the fiber function can be passed to the constructor of the superclass. In the following example, the fiber function is a member function:
Get hands-on with 1400+ tech skills courses.