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 #GInitable you can
optionally call g_initable_init() 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
%G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL, and
the object doesn't support cancellable initialization, the error
%G_IO_ERROR_NOT_SUPPORTED will be returned.
As with #GInitable, 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.
Implementations of this method must be idempotent: i.e. multiple calls
to this function with the same argument should return the same results.
Only the first call initializes the object; further calls return the result
of the first call. This is so that it's safe to implement the singleton
pattern in the GObject constructor function.
For classes that also support the #GInitable 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 #GAsyncInitable interface without overriding
any interface 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 #GInitable you can optionally call g_initable_init() 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 %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL, and the object doesn't support cancellable initialization, the error %G_IO_ERROR_NOT_SUPPORTED will be returned.
As with #GInitable, 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.
Implementations of this method must be idempotent: i.e. multiple calls to this function with the same argument should return the same results. Only the first call initializes the object; further calls return the result of the first call. This is so that it's safe to implement the singleton pattern in the GObject constructor function.
For classes that also support the #GInitable 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 #GAsyncInitable interface without overriding any interface methods.