The GLib.Task
provide low-level API for performing asynchronous operations.
var task = new GLib.Task (null, null, (obj, result) => {
try {
var ret = result.propagate_boolean ();
} catch (Error err) {
// handler err...
}
});
Later in a thread or a callback:
task.return_boolean (true);
To use the GLib.Task
internal thread pool:
task.run_in_thread (() => {
task.return_boolean (true);
});