Re: [Vala] Interfaces and asynchronous methods



On Tue, Aug 14, 2012 at 2:49 AM, rastersoft <raster rastersoft com> wrote:


BTW, Jim Nelson answered that I have to do something like this:

run_async.begin(on_run_async_completed);

/* ... */

void on_run_async(AsyncResult result, Object? source) {
    int result = run_async.end(result);
}


Is this correct?



Jim's right, you can't just call an async method directly; you need to call
.begin() and follow up with a completion method.  Once you're inside an
async method, you can use "yield" to call other async methods.

You should give this a read, it explains async usage really well:
https://live.gnome.org/Vala/Tutorial#Asynchronous_Methods

Some further examples here:
https://live.gnome.org/Vala/AsyncSamples

  - Eric


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]