Tutorial by Examples

public async int call_async () { return 1; } call_async.begin ((obj, res) => { var ret = call_async.end (res); }); To call an asynchronous functions from a synchronous context, use the begin method and pass a callback to receive the result. The two arguments are: obj is a GLi...
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: t...
In order to chain asynchronous operations and avoid a callback hell, Vala supports the yield statement. Used with an asynchronous invocation, it will pause the current coroutine until the call is completed and extract the result. Used alone, yield pause the current coroutine until it's being woken...

Page 1 of 1