Class (GI Class)

Dex-1DexFiber

Dex.Fiber is a fiber (a stack-based coroutine) which itself is a Dex.Future.

When the fiber completes execution it will either resolve or reject the with the result or error.

You may treat a Dex.Fiber like any other Dex.Future which makes it simple to integrate fibers into other processing chains.

Dex.Fiber are provided their own stack separate from a thread's main stack, and are automatically scheduled as necessary.

Use Dex.Future.await and similar functions to await the result of another future within the fiber and the fiber will be suspended allowing another fiber to run and/or the rest of the application's main loop.

Once a fiber is created, it is pinned to that scheduler. Use Dex.Scheduler.spawn to create a fiber on a specific scheduler.

Hierarchy (View Summary)

Index
$gtype: GType<Dex.Fiber>
  • Cooperatively yields execution back to the current scheduler.

    This may only be called from within a Dex.Fiber. If it is called from any other context, error is set to Dex.Error.NO_FIBER.

    Returns boolean

    1.2

  • Suspends the current Dex.Fiber and resumes when future has completed.

    If future is completed when this function is called, the fiber will handle the result immediately.

    This function may only be called within a Dex.Fiber. To do otherwise will return false and error set to Dex.Error.NO_FIBER.

    It is an error to call this function in a way that would cause intermediate code to become invalid when resuming the stack. For example, if a foreach-style function taking a callback was to suspend from the callback, undefined behavior may occur such as thread-local-storage having changed.

    Returns boolean

    true if the future resolved, otherwise false and error is set.

    GLib.Error

  • Awaits on future and returns the gboolean result.

    If the result is not a gboolean, error is set.

    Returns boolean

    the gboolean, or false and error is set

    GLib.Error

  • Awaits on future and returns the G_TYPE_BOXED based result.

    Returns null

    the boxed result, or null and error is set.

    GLib.Error

  • Awaits on future and returns the result as an double.

    The resolved value must be of type G_TYPE_DOUBLE or error is set.

    Returns number

    an double, or 0 in case of failure and error is set.

    GLib.Error

  • Awaits on future and returns the enum result.

    If the result is not a G_TYPE_ENUM, error is set.

    Returns number

    the enum or 0 and error is set.

    GLib.Error

  • Awaits on future and returns the resulting file-descriptor.

    The resolved value must be of type DEX_TYPE_FD or error is set.

    Returns number

    a valid file descriptor or -1. you may get -1 without error being set if there was no rejected future.

    0.10

    GLib.Error

  • Awaits on future and returns the flags result.

    If the result is not a G_TYPE_FLAGS, error is set.

    Returns number

    the flags or 0 and error is set.

    GLib.Error

  • Awaits on future and returns the result as an float.

    The resolved value must be of type G_TYPE_FLOAT or error is set.

    Returns number

    an float, or 0 in case of failure and error is set.

    GLib.Error

  • Awaits on future and returns the result as an int.

    The resolved value must be of type G_TYPE_INT or error is set.

    Returns number

    an int, or 0 in case of failure and error is set.

    GLib.Error

  • Awaits on future and returns the result as an int64.

    The resolved value must be of type G_TYPE_INT64 or error is set.

    Returns number

    an int64, or 0 in case of failure and error is set.

    GLib.Error

  • Awaits on future and returns the string result.

    If the result is not a G_TYPE_STRING, error is set.

    Returns string

    the string or null and error is set

    GLib.Error

  • Awaits on future and returns the result as an uint.

    The resolved value must be of type G_TYPE_UINT or error is set.

    Returns number

    an uint, or 0 in case of failure and error is set.

    GLib.Error

  • Awaits on future and returns the result as an uint64.

    The resolved value must be of type G_TYPE_UINT64 or error is set.

    Returns number

    an uint64, or 0 in case of failure and error is set.

    GLib.Error

  • Disowns a future, allowing it to run to completion even though there may be no observer interested in the futures completion or rejection.

    Returns void

    0.4

  • 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