Class (GI Class)

Dex-1DexMainScheduler

Dex.MainScheduler is the scheduler used on the default thread of an application. It is meant to integrate with your main loop.

This scheduler does the bulk of the work in an application.

Use Dex.ThreadPoolScheduler when you want to offload work to a thread and still use future-based programming.

Hierarchy (View Summary)

Index
  • 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);
    }

    Parameters

    Returns Dex.Future

    a Dex.Future that will resolve or reject when func completes (or its resulting Dex.Future completes).

  • 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.

    Returns void

Interfaces

SignalSignatures