Dex.Scheduler¶
- Subclasses:
Methods¶
- Inherited:
class |
|
class |
|
class |
|
|
|
|
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Dex.Scheduler¶
- Bases:
- Abstract:
Yes
Dex.Scheduleris the base class used by schedulers.Schedulers are responsible for ensuring asynchronous IO requests and completions are processed. They also schedule closures to be run as part of future result propagation. Additionally, they manage
Dex.Fiberexecution and suspension.Specialized schedulers such as
Dex.ThreadPoolSchedulerwill do this for a number of threads and dispatch new work between them.- classmethod get_default()¶
- Returns:
- Return type:
Gets the default scheduler for the process.
The default scheduler executes tasks within the default
GLib.MainContext. Typically that is the main thread of the application.
- classmethod get_thread_default()¶
- Returns:
a
Dex.SchedulerorNone- Return type:
Gets the default scheduler for the thread.
- classmethod ref_thread_default()¶
- Returns:
a
Dex.SchedulerorNone- Return type:
Gets the thread default scheduler with the reference count incremented.
- get_main_context()¶
- Returns:
- Return type:
Gets the default main context for a scheduler.
This may be a different value depending on the calling thread.
For example, calling this on the #DexThreadPoolScheduer from outside a worker thread may result in getting a shared
GLib.MainContextfor the process.However, calling from a worker thread may give you a
GLib.MainContextspecifically for that thread.
- push(func, *func_data)¶
- Parameters:
func (
Dex.SchedulerFunc) – the function callback
Queues func to run on self.
- spawn(stack_size, func, *func_data)¶
- Parameters:
stack_size (
int) – stack size in bytes or 0func (
Dex.FiberFunc) – aDex.FiberFunc
- Returns:
a
Dex.Futurethat will resolve or reject when func completes (or its resultingDex.Futurecompletes).- Return type:
Request self to spawn a
Dex.Fiber.The fiber will have its own stack and cooperatively schedules among other fibers sharing the scheduler.
If stack_size is 0, it will set to a sensible default. Otherwise, it is rounded up to the nearest page size.