SignalconnectSignalconnect_SignalemitGets the default main context for a scheduler.
This may be a different value depending on the calling thread.
For example, calling this on the Dex.ThreadPoolScheduler 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.
Request scheduler to spawn a Dex.Fiber.
The fiber will have its own stack and cooperatively schedules among other fibers sharing the scheduler.
This can be called from any thread. The resulting fiber runs on the thread
associated with the scheduler.
If stack_size is 0, it will set to a sensible default. Otherwise, it is
rounded up to the nearest page size.
static DexFuture *
fiber_func (gpointer data)
{
GInputStream *stream = data;
GError *error = NULL;
GBytes *bytes = NULL;
if (!(bytes = dex_await_boxed (dex_input_stream_read_bytes (stream, 4096, 0), &error)))
return dex_future_new_for_error (error);
...
return dex_future_new_true ();
}
DexFuture *
spawn_fiber (GInputStream *stream)
{
return dex_scheduler_spawn (NULL, 0, fiber_func,
g_object_ref (stream),
g_object_unref);
}
stack size in bytes or 0
a Dex.Future that will resolve or reject when func completes (or its resulting Dex.Future completes).
Since 1.2spawn_Request scheduler to spawn a Dex.Coroutine and execute
func with user data.
If the function returns null while suspended, it should have set an awaited
future in its context using one of the DEX_COROUTINE_SUSPEND_* helpers.
coroutine entrypoint
a Dex.Future that will resolve or reject when func finishes or returns an error.
Staticget_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.
Staticget_Staticref_Releases a reference on the given object, and decreases its reference count by one.
If it was the last reference, the resources associated to the instance are freed.
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.