Skip to content

Draft: girepository: Add support for typelib async loading

Marco Trevisan requested to merge 3v1n0/glib:gir-async-repo-loading into main

Add an API to load typelibs in different threads, so that bindings can actually perform async imports of typelibs and not block on IO when doing library imports.

Threads are created only when this is actually needed, otherwise we just return what we have.

Multiple threads can request a specific module concurrently, but only first one will actually do the loading.

To allow cancellation of async requests, given that we can't depend on Gio directly, I've added a simple implementation for a "cancellable" struct that can be passed to the calling function and that allows the caller to cancel the operation atomically without having to monitor the requests in other ways (such as keeping a list of requests and allowing them to be cancelled via another function).

This is the port of gobject-introspection!415 (closed) so check there for previous discussions.

Merge request reports