Adds a function to be called whenever there are no higher priority
events pending. If the function returns false it is automatically
removed from the list of event sources and will not be called again.
This variant of g_idle_add_full() calls function with the GDK lock
held. It can be thought of a MT-safe version for GTK+ widgets for the
following use case, where you have to worry about idle_callback()
running in thread A and accessing self after it has been finalized
in thread B:
static gboolean idle_callback (gpointer data) { // `gdk_threads_enter()`; would be needed for `g_idle_add()`
SomeWidget *self = data; // do stuff with self
self->idle_id = 0;
// `gdk_threads_leave()`; would be needed for `g_idle_add()` returnFALSE; }
staticvoid some_widget_do_stuff_later (SomeWidget *self) { self->idle_id = gdk_threads_add_idle (idle_callback, self) // using `g_idle_add()` here would require thread protection in the callback }
Adds a function to be called whenever there are no higher priority events pending. If the function returns
falseit is automatically removed from the list of event sources and will not be called again.This variant of
g_idle_add_full()callsfunctionwith the GDK lock held. It can be thought of a MT-safe version for GTK+ widgets for the following use case, where you have to worry aboutidle_callback()running in thread A and accessingselfafter it has been finalized in thread B: