Dex – 1
Description: Reference for Dex-1

### Namespace

# Dex – 1

A GNOME library for deferred execution

Version | 1.1.0
Authors | Christian Hergert
License | LGPL-2.1-or-later
Website | https://gitlab.gnome.org/GNOME/libdex/
Source | https://gitlab.gnome.org/GNOME/libdex/

#### Build

C headers | `libdex.h`
pkg-config files | `libdex-1`

#### Dependencies

GLib—2.0 | The base type system library
| Browse documentation
GObject—2.0 | The base type system library
| Browse documentation

#### Additional documentation

- Overview
- Terminology
- Integrating GAsyncResult
- Asynchronous IO
- Schedulers & FIbers
- Threads for Blocking APIs
- Channels
- D-Bus
- Debugging
- Classes Hierarchy

#### Classes

AsyncPair |
AsyncResult | `DexAsyncResult` is used to integrate a `DexFuture` with `GAsyncResult`.
Block | `DexBlock` represents a callback closure that can be scheduled to run within a specific `GMainContext`.
Cancellable | `DexCancellable` is a simple cancellation primitive which allows for you to create `DexFuture` that will reject upon cancellation.
Channel |
DBusInterfaceSkeleton | `DexDBusInterfaceSkeleton` provides integration between libdex and the GDBus codegen. If the gdbus-codegen dex extension is used, all generated InterfaceSkeletons inherit from `DexDBusInterfaceSkeleton` instead of `GDBusInterfaceSkeleton`, which allows the use of the API exposed here.
Delayed | `DexDelayed` is a future which will resolve or reject the value of another `DexFuture` when `dex_delayed_release()` is called.
Fiber | `DexFiber` is a fiber (a stack-based coroutine) which itself is a `DexFuture`.
Future | `DexFuture` is the base class representing a future which may resolve with a value or reject with error at some point in the future.
FutureListModel | This class provides a `GListModel` implementation that will expand to the contents of another `GListModel` from a `DexFuture`. since: 1.1
FutureSet | `DexFutureSet` represents a set of `DexFuture`.
MainScheduler | `DexMainScheduler` is the scheduler used on the default thread of an application. It is meant to integrate with your main loop.
Object | `DexObject` is the basic building block of types defined within libdex. Futures, Schedulers, and Channels all inherit from `DexObject` which provides features like thread-safe weak pointers and memory management operations.
Promise | `DexPromise` is a convenient `DexFuture` for propagating a result or rejection in application and library code.
Scheduler | `DexScheduler` is the base class used by schedulers.
StaticFuture | `DexStaticFuture` represents a future that is resolved from the initial state.
ThreadPoolScheduler | `DexThreadPoolScheduler` is a `DexScheduler` that will dispatch work items and fibers to sub-schedulers on a specific operating system thread.
Timeout | `DexTimeout` is a `DexFuture` that will reject after the configured period of time.
UnixSignal | `DexUnixSignal` is a `DexFuture` that will resolve when a specific unix signal has been received.

#### Structs

AioContext |
AsyncPairInfo |

#### Enumerations

BlockKind |
FutureStatus |

#### Bitfields

DBusInterfaceSkeletonFlags | Flags describing the behavior of a `GDBusInterfaceSkeleton` instance. since: 1.1

#### Error Domains

Error |

#### Callbacks

FiberFunc | This function prototype is used for spawning fibers. A fiber is a lightweight, cooperative-multitasking feature where the fiber is given its own stack. The fiber runs until it reaches a point of suspension (using `dex_await()` or similar) or exits the fiber.
FutureCallback | A `DexFutureCallback` can be executed from a `DexBlock` as response to another `DexFuture` resolving or rejecting.
SchedulerFunc |
ThreadFunc | A function which will be run on a dedicated thread. since: 1.0

#### Functions

aio_read | An asynchronous `pread()` wrapper.
aio_write | An asynchronous `pwrite()` wrapper.
async_initable_init | A helper for `g_async_initable_init_async()`. since: 1.0
bus_get | Wrapper for `g_bus_get()`. since: 0.4
bus_own_name_on_connection | Wrapper for `g_bus_own_name()`. since: 1.1
data_input_stream_read_line | Reads a line from the data input stream. since: 1.1
dbus_connection_call | Wrapper for `g_dbus_connection_call()`. since: 0.4
dbus_connection_call_with_unix_fd_list | Wrapper for `g_dbus_connection_call_with_unix_fd_list()`. since: 0.4
dbus_connection_close | Asynchronously closes a connection. since: 1.0
dbus_connection_send_message_with_reply | Wrapper for `g_dbus_connection_send_message_with_reply()`. since: 0.4
error_quark |
fd_watch | Creates a new GSource that will fire when `events` is satisfied. since: 1.1
file_copy | Asynchronously copies a file and returns a `DexFuture` which can be observed for the result.
file_create | Wraps `g_file_create()` as a `DexFuture`. since: 1.1
file_delete | Asynchronously deletes a file and returns a `DexFuture` which can be observed for the result.
file_enumerate_children |
file_enumerator_next_files | Wraps `g_file_enumerator_next_files_async()`.
file_load_contents_bytes |
file_make_directory | Asynchronously creates a directory and returns `DexFuture` which can be observed for the result.
file_make_directory_with_parents | Creates a directory at `file`. since: 1.0
file_move |
file_query_exists | Queries to see if `file` exists asynchronously. since: 0.6
file_query_file_type |
file_query_info |
file_read | Asynchronously opens a file for reading.
file_replace | Opens a stream that will replace `file` on disk when the input stream is closed.
file_replace_contents_bytes | Wraps `g_file_replace_contents_bytes_async()`.
file_set_attributes | since: 1.0
find_program_in_path | Locates the first executable named program in the user’s path. since: 1.1
get_major_version | Gets the major version number equivalent to `DEX_MAJOR_VERSION` at compile time of libdex. since: 1.1
get_micro_version | Gets the micro version number equivalent to `DEX_MICRO_VERSION` at compile time of libdex. since: 1.1
get_min_stack_size |
get_minor_version | Gets the minor version number equivalent to `DEX_MINOR_VERSION` at compile time of libdex. since: 1.1
get_page_size |
init |
input_stream_close |
input_stream_read | Reads `count` bytes from an input stream into a pre-allocated `buffer`. The `buffer` must stay valid for the lifetime of this future.
input_stream_read_bytes | Reads `count` bytes from the stream.
input_stream_skip |
io_stream_close |
mkdir_with_parents | Similar to `g_mkdir_with_parents()` but runs on a dedicated thread. since: 1.1
output_stream_close |
output_stream_splice |
output_stream_write |
output_stream_write_bytes | Writes `bytes` to `stream`.
resolver_lookup_by_name |
socket_client_connect |
socket_listener_accept |
subprocess_wait_check | Creates a future that awaits for `subprocess` to complete using `g_subprocess_wait_check_async()`. since: 0.4
thread_spawn | Spawns a new thread named `thread_name` running `thread_func` with `user_data` passed to it. since: 1.0
thread_wait_for | Use this when running on a thread spawned with `dex_thread_spawn()` and you need to block the thread until `future` has resolved or rejected. since: 1.0
unlink | This runs `g_unlink()` on a dedicated thread. since: 1.1
value_dup_object | Retrieves the `DexObject` stored inside the given `value`. since: 1.0
value_get_object | Retrieves the `DexObject` stored inside the given `value`. since: 0.4
value_set_object | Stores the given `DexObject` inside `value`. since: 0.4
value_take_object | Stores the given `DexObject` inside `value`. since: 0.4

#### Function Macros

ASYNC_PAIR_INFO_BOOLEAN |
ASYNC_PAIR_INFO_BOXED |
ASYNC_PAIR_INFO_INT |
ASYNC_PAIR_INFO_INT64 |
ASYNC_PAIR_INFO_LONG |
ASYNC_PAIR_INFO_OBJECT |
ASYNC_PAIR_INFO_POINTER |
ASYNC_PAIR_INFO_STRING |
ASYNC_PAIR_INFO_UINT |
ASYNC_PAIR_INFO_UINT64 |
ASYNC_PAIR_INFO_ULONG |
DEPRECATED_FOR |
DEPRECATED_IN_1_0_FOR |
DEPRECATED_IN_1_1_FOR |
future_new_false |
future_new_true |
OBJECT_TYPE |
OBJECT_TYPE_NAME |
return_error_if_fail |
UNAVAILABLE |