Dex.Fiber¶
- Subclasses:
None
Methods¶
- Inherited:
class |
|
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Dex.Fiber¶
- Bases:
- Abstract:
No
DexFiberis a fiber (a stack-based coroutine) which itself is a [class`Dex`.Future].When the fiber completes execution it will either resolve or reject the with the result or error.
You may treat a
DexFiberlike any otherDexFuturewhich makes it simple to integrate fibers into other processing chains.DexFiberare provided their own stack separate from a thread’s main stack, and are automatically scheduled as necessary.Use [method`Dex`.Future.await] and similar functions to await the result of another future within the fiber and the fiber will be suspended allowing another fiber to run and/or the rest of the application’s main loop.
Once a fiber is created, it is pinned to that scheduler. Use [method`Dex`.Scheduler.spawn] to create a fiber on a specific scheduler.
- classmethod yield_()¶
- Raises:
- Returns:
Trueif execution was yielded and the fiber resumed successfully; otherwiseFalseand error is set.- Return type:
Cooperatively yields execution back to the current scheduler.
This may only be called from within a [class`Dex`.Fiber]. If it is called from any other context, error is set to
Dex.Error.NO_FIBER.Added in version 1.2.