On 30 March 2017 at 11:21, Gabriele Greco <gabriele.gr...@wyscout.com> wrote:
>>
>> Thanks. While I can remember have read your explanations somewhere
>> already, I really missed that g_main_context_invoke() function.
>
>
> There is some difference/advantage on calling:
>
> g_main_context_invoke(NULL, func, data)?
>
> instead of
>
> g_idle_add(func, data);

Calling g_main_context_invoke() will ensure that the main context is
owned and acquired during the invocation. As I said, it will do the
right thing depending on the type of context you are using.

> As far as I can see from the function documentations g_main_context_invoke
> seems useful when having multiple contexts on different threads, I'm wrong?

Correct, but remember that different libraries may have different
contexts in different threads already by the time you call your code.

It's also a good rule of thumb to start using this function, as it
will be more efficient once you start using API like GTask, with its
own main context.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to