Callbacks¶
  | 
|
  | 
|
  | 
Details¶
- Dex.FiberFunc(*user_data)¶
 - Parameters:
 - Returns:
 a
Dex.FutureorNone- Return type:
 Dex.FutureorNone
This function prototype is used for spawning fibers. A fiber is a lightweight, cooperative-multitasking feature where the fiber is given its own stack. The fiber runs until it reaches a point of suspension (using
dex_awaitor 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.Futureuser_data (
objectorNone) – closure data associated with the callback
- Returns:
 a
Dex.FutureorNone- Return type:
 Dex.FutureorNone
A
Dex.FutureCallbackcan be executed from aDex.Blockas response to anotherDex.Futureresolving 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.FiberviaDex.Scheduler.spawn().