GLib.MainContext.get_thread_default

function get_thread_default(): GLib.MainContext {
    // Gjs wrapper for g_main_context_get_thread_default()
}
  

Gets the thread-default GLib.MainContext for this thread. Asynchronous operations that want to be able to be run in contexts other than the default one should call this method or GLib.main_context_ref_thread_default to get a GLib.MainContext to add their #GSources to. (Note that even in single-threaded programs applications may sometimes want to temporarily push a non-default context, so it is not safe to assume that this will always return null if you are running in the default thread.)

If you need to hold a reference on the context, use GLib.main_context_ref_thread_default instead.

Since 2.22

Returns

the thread-default GLib.MainContext, or null if the thread-default context is the global default context.