Class
DexFuture
unstable since: 1
Description [src]
final class Dex.Future : GObject.TypeInstance
{
/* No available fields */
}
DexFuture
is the base class representing a future which may resolve with
a value or reject with error at some point in the future.
It is the basis for libdex’s concurrency and parallelism model.
Use futures to represent work in progress and allow consumers to build robust processing chains up front which will complete or fail as futures resolve or reject.
When running on a DexFiber
, you may use dex_await()
and similar functions
to suspend the current thread and return upon completion of the dependent future.
Available since: 1
Constructors
dex_future_all
Creates a new DexFuture
that will resolve or reject when all futures
either resolve or reject.
unstable since: 1
dex_future_all_race
Creates a new DexFuture
that will resolve when all futures resolve
or reject as soon as the first future rejects.
unstable since: 1
dex_future_all_racev
Creates a new DexFuture
that resolves when all futures resolve.
unstable since: 1
dex_future_any
Creates a new DexFuture
that will resolve when any dependent future
resolves, providing the same result as the resolved future.
unstable since: 1
dex_future_anyv
Creates a new DexFuture
that resolves when the first future resolves.
unstable since: 1
dex_future_finally_loop
Asynchronously calls callback
when future
rejects or resolves.
unstable since: 1
dex_future_first
Creates a new DexFuture
that resolves or rejects as soon as the
first dependent future resolves or rejects, sharing the same result.
unstable since: 1
dex_future_firstv
Creates a new DexFuture
that resolves or rejects as soon as the
first dependent future resolves or rejects, sharing the same result.
unstable since: 1
dex_future_new_for_errno
Creates a new rejected future using errno_
as the value
of errno for the GError.
since: 0.4
dex_future_new_for_pointer
Creates a new DexFuture
that is resolved with pointer
as a G_TYPE_POINTER
.
unstable since: 1
dex_future_new_infinite
Creates an infinite future that will never resolve or reject. This can be useful when you want to mock a situation of “run forever” unless another future rejects or resolves.
since: 0.4
dex_future_new_take_variant
Creates a new DexFuture
that is resolved with v_variant
.
unstable since: 1
Instance methods
dex_await_pointer
Calls dex_await()
and returns the value of g_value_get_pointer(),
otherwise error
is set if the future rejected.
unstable since: 1
dex_future_disown
Disowns a future, allowing it to run to completion even though there may be no observer interested in the futures completion or rejection.
since: 0.4
dex_future_is_pending
This is a convenience function equivalent to calling
dex_future_get_status()
and checking for DEX_FUTURE_STATUS_PENDING
.
unstable since: 1
dex_future_is_rejected
This is a convenience function equivalent to calling
dex_future_get_status()
and checking for DEX_FUTURE_STATUS_REJECTED
.
unstable since: 1
dex_future_is_resolved
This is a convenience function equivalent to calling
dex_future_get_status()
and checking for DEX_FUTURE_STATUS_RESOLVED
.
unstable since: 1
dex_future_set_static_name
Sets the name of the future with a static/internal string.
unstable since: 1