GLib.MainContext.ref_thread_default
Description: Reference for GLib.MainContext.ref_thread_default

### Function

# GLib MainContextref_thread_default

since: 2.32

#### Declaration [src]

    GMainContext*
    g_main_context_ref_thread_default (
      void
    )

#### Description [src]

Gets a reference to the thread-default `GMainContext` for this thread

This is the same as `g_main_context_get_thread_default()`, but it also adds a reference to the returned main context with `g_main_context_ref()`. In addition, unlike `g_main_context_get_thread_default()`, if the thread-default context is the global-default context, this will return that `GMainContext` (with a ref added to it) rather than returning `NULL`.

Available since: 2.32

#### Return value

Type: `GMainContext`

The thread-default main context.

The caller of the function takes ownership of the data, and is responsible for freeing it.