Dex.ThreadPoolScheduler¶
- Subclasses:
None
Methods¶
- Inherited:
class |
|
class |
|
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Dex.ThreadPoolScheduler¶
- Bases:
- Abstract:
No
Dex.ThreadPoolScheduleris aDex.Schedulerthat will dispatch work items and fibers to sub-schedulers on a specific operating system thread.Dex.Fiberwill never migrate from the thread they are created on to reduce chances of safety issues involved in tracking state between CPU.New work items are placed into a global work queue and then dispatched efficiently to a single thread pool worker using a specialized async semaphore. On modern Linux using io_uring, this wakes up a single worker thread and therefore is not subject to “thundering herd” common with global work queues.
When a worker creates a new work item, it is placed into a work stealing queue owned by the thread. Other worker threads may steal work items when they have exhausted their own work queue.
- classmethod get_default()¶
- Returns:
- Return type:
Gets the default thread pool scheduler for the instance.
This function is useful to allow programs and libraries to share an off-main-thread scheduler without having to coordinate on where the scheduler instance is created or owned.
- classmethod new()¶
- Returns:
- Return type:
Creates a new
Dex.Schedulerthat executes work items on a thread pool.