Re: [Vala] How to get return values from async methods



On Mi, 2012-10-17 at 20:26 -0007, Jim Nelson wrote:
Yes, your closure isn't being called until some time after
get_results() returns.


Remember, async works with the event loop.  A good way to think of it
is like this: some_async_method.begin() doesn't call the method,
rather .begin schedules the method on the event loop for later
execution.  (This is technically not true, some code in
some_async_method() may be executed immediately, but in my experience
thinking of it as being scheduled is the safest way to code async in
Vala.)

Thanks, Jim,
So, the only way to get some return values from async methods would be
to either issue a signal from within the closure, passing the result or
to register a callback instead of the closure, right?

br,

-- 
tomw <tomw ubilix com>




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