Dex.Scheduler¶
- Subclasses:
Methods¶
- Inherited:
class |
|
class |
|
class |
|
|
|
|
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Dex.Scheduler¶
- Bases:
- Abstract:
Yes
Dex.Scheduler
is 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.Fiber
execution and suspension.Specialized schedulers such as
Dex.ThreadPoolScheduler
will 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.Scheduler
orNone
- Return type:
Gets the default scheduler for the thread.
- classmethod ref_thread_default()¶
- Returns:
a
Dex.Scheduler
orNone
- 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.MainContext
for the process.However, calling from a worker thread may give you a
GLib.MainContext
specifically for that thread.
- push(func, *func_data)¶
- Parameters:
func (
Dex.SchedulerFunc
) – the function callback
Queues func to run on self.
- spawn(stack_size, *func_data)¶
- Parameters:
- Returns:
a
Dex.Future
that will resolve or reject when func completes (or it’s resultingDex.Future
completes).- Return type:
Request self to spawn a
Dex.Fiber
.The fiber will have it’s own stack and cooperatively schedules among other fibers sharing the schaeduler.
If stack_size is 0, it will set to a sensible default. Otherwise, it is rounded up to the nearest page size.