gmaincontextpending
g_main_context_pending is a function in the GLib library that reports whether a given GMainContext has any pending work to dispatch. It checks the set of event sources in the context and returns true if there are sources that are ready to be dispatched (for example, timers whose timeouts have expired or I/O sources that are ready). It does not execute any callbacks or block; it only indicates the presence of pending work.
gboolean g_main_context_pending (GMainContext *context);
If context is NULL, the function operates on the default global main context. The return value is
- The function is useful for determining whether a main loop has work to do without blocking.
- It can be used before calling g_main_context_iteration or g_main_context_dispatch to decide whether to perform a non-blocking
- It does not cause any callbacks to run; it merely reports the state of the main context.
g_main_context_pending is part of GLib’s event loop framework, alongside other functions such as g_main_context_iteration, g_main_context_new, and
GLib, GMainContext, GSource, g_main_context_iteration, g_idle_add, g_timeout_add.