Callbacks¶
|
|
|
|
|
Details¶
- Dex.FiberFunc(*user_data)¶
- Parameters:
- Returns:
a
Dex.Future
orNone
- Return type:
Dex.Future
orNone
This function prototype is used for spawning fibers. A fiber is a lightweight, cooperative-multitasking feature where the fiber is given it’s own stack. The fiber runs until it reaches a point of suspension (using
dex_await
or similar) or exits the fiber.When suspended, the fiber is placed onto a queue until it is runnable again. Once runnable, the fiber is scheduled to run from within whatever scheduler it was created with.
See
dex_scheduler_spawn()
- Dex.FutureCallback(future, *user_data)¶
- Parameters:
future (
Dex.Future
) – a resolved or rejectedDex.Future
user_data (
object
orNone
) – closure data associated with the callback
- Returns:
a
Dex.Future
orNone
- Return type:
Dex.Future
orNone
A
Dex.FutureCallback
can be executed from aDex.Block
as response to anotherDex.Future
resolving or rejecting.The callback will be executed within the scheduler environment the block is created within when using
Dex.Future.then
(),Dex.Future.catch
(),Dex.Future.finally_
(),Dex.Future.all
(), and similar functions.This is the expected way to handle completion of a future when not using
Dex.Fiber
viaDex.Scheduler.spawn
().