Interface

Gio-2.0GioAsyncInitableInterface

Interface for implementing AsyncInitable. Contains only the virtual methods that need to be implemented.

interface Interface<A extends GObject.Object = GObject.Object> {
    vfunc_init_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.AsyncInitable.Interface<A>>,
    ): void;
    vfunc_init_finish(res: Gio.AsyncResult): boolean;
}

Type Parameters

Hierarchy (View Summary)

Index

Methods

  • Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements Gio.Initable you can optionally call g_initable_init() instead.

    This method is intended for language bindings. If writing in C, g_async_initable_new_async() should typically be used instead.

    When the initialization is finished, callback will be called. You can then call g_async_initable_init_finish() to get the result of the initialization.

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and the object doesn't support cancellable initialization, the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    As with Gio.Initable, if the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. They will often fail with g_critical() or g_warning(), but this must not be relied on.

    Callers should not assume that a class which implements Gio.AsyncInitable can be initialized multiple times; for more information, see g_initable_init(). If a class explicitly supports being initialized multiple times, implementation requires yielding all subsequent calls to init_async() on the results of the first call.

    For classes that also support the Gio.Initable interface, the default implementation of this method will run the g_initable_init() function in a thread, so if you want to support asynchronous initialization via threads, just implement the Gio.AsyncInitable interface without overriding any interface methods.

    Parameters

    Returns void