Re: Input event reduction



On 30 March 2017 at 10:10, Nicola Fontana <ntd entidi it> wrote:

When you are ready from (1) you can spawn the idle callback with
g_source_attach()... no needs for gdk_threads_add_idle(). In the
following StackOverflow answer I provided an example in C:

A small correction: use g_main_context_invoke() instead, as it will
always do the right thing.

The only reason to prefer gdk_threads_add_idle() to g_idle_add() (or
g_main_context_invoke()) is that your own code may depend on
additional libraries that still attempt at acquiring the GDK thread
lock — i.e. they use gdk_threads_enter()/gdk_threads_leave() inside a
separate thread to mark a critical section. No newly written,
maintained, or portable code should do that, so you can safely use
g_idle_add() or, better yet, g_main_context_invoke().

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]


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