Re: [Vala] question on async methods



Hello,

                    في ر، 02-03-2011 عند 16:30 +0100 ، كتب Luca Dionisi:
What I guess is that:
 . when a async method never calls a yield, then it is implicit
    a yield at the end of the method
 . the implicit continuation is implicitly registered with the MainLoop
    perhaps with a higher priority than Idle.

Is my interpretation correct?
More or less: when an async method never yields, it isn't necessarily
running in the main loop, in this case it schedules its completion as an
idle [1], since otherwise it won't be considered async (i.e. it will
keep running until it's finished, and if it was called from an async
method using the yield keyword, flow passes back to the async method
that called it). Otherwise (when it has already been run from the
mainloop), it can complete in the .

Is this behavior wanted?
I guess it is.

I find it particularly annoying because I would prefer to implement my
own scheduler instead of relying on MainLoop.

Well, this was mainly done with async IO in mind, so if you need a very
specific scheduling, maybe you should look at alternatives.

HTH,
Abderrahim

[1] it does this using g_simple_async_result_complete_in_idle, see
http://library.gnome.org/devel/gio/stable/GSimpleAsyncResult.html#g-simple-async-result-complete-in-idle




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