Dex.ThreadPoolScheduler
Description: Reference for Dex.ThreadPoolScheduler

### Class

# DexThreadPoolScheduler

#### Description [src]

    final class Dex.ThreadPoolScheduler : GObject.TypeInstance
    {
      /* No available fields */
    }

`DexThreadPoolScheduler` is a `DexScheduler` that will dispatch work items and fibers to sub-schedulers on a specific operating system thread.

`DexFiber` will 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.

#### Hierarchy

#### Ancestors

- DexScheduler
- DexObject

#### Constructors

###### dex_thread_pool_scheduler_new

Creates a new `DexScheduler` that executes work items on a thread pool.

#### Functions

###### dex_thread_pool_scheduler_get_default

Gets the default thread pool scheduler for the instance.

#### Instance methods

##### Methods inherited from DexScheduler (3)

###### dex_scheduler_get_main_context

Gets the default main context for a scheduler.

###### dex_scheduler_push

Queues `func` to run on `scheduler`.

###### dex_scheduler_spawn

Request `scheduler` to spawn a `DexFiber`.

##### Methods inherited from DexObject (2)

###### dex_ref

Acquires a reference on the given object, and increases its reference count by one.

###### dex_unref

Releases a reference on the given object, and decreases its reference count by one.