gmain: Add GMainContextPusher convenience API

This is like `GMutexLocker`, in that if you are able to use
`g_autoptr()`, it makes popping a `GMainContext` off the thread-default
main context stack easier when exiting a function.

A few uses of `G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS` are needed to
avoid warnings when building apps against GLib with
`GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2019-10-23 11:35:58 +01:00
parent 65ce1c3fcd
commit 21f8f89820
4 changed files with 114 additions and 0 deletions

View File

@@ -781,6 +781,11 @@ g_main_set_poll_func
g_main_context_invoke
g_main_context_invoke_full
<SUBSECTION>
GMainContextPusher
g_main_context_pusher_new
g_main_context_pusher_free
<SUBSECTION>
g_main_context_get_thread_default
g_main_context_ref_thread_default