On 27/05/17 19:17, Carlo Lobrano wrote:
>> GTask? If you have any doubt or not sure how to do it, leave it with
>> GSimpleAsyncResult and I'll do the port to GTask as a follow up patch,
>> so that you can see what the changes were; it really is very easy, you
>> can check Ben's last emails doing lots of these GTask ports.
> Sure, I'll try myself first ;)
> 

The two main changes:

 * Instead of having a Context that stores The self GObject, the 
GSimpleAsyncResult and possibly a GCancellable, and pass that Context around; 
what you do is create a GTask that already holds the self GObject and the 
possible GCancellable, and you create a context that you attach to the GTask 
with g_task_set_task_data(). Basically, instead of having the Context own the 
GSimpleAsyncResult, you have the GTask own the context.

 * There is no complete() vs complete_in_idle(). Instead, the completion of the 
async method is done directly when setting the result with g_task_return_XXX(), 
and the GTask will automatically decide whether the completion is done in place 
or in idle. So beware, most of the bugs we have are related to this change. If 
you were doing anything between the GSimpleAsyncResult set result and complete, 
now both those steps are done together in g_task_return()!

-- 
Aleksander
https://aleksander.es
_______________________________________________
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to