GLib.MainContext.acquire

### Method

# GLib MainContextacquire

#### Declaration

    gboolean
    g_main_context_acquire (
      GMainContext* context
    )

#### Description

Tries to become the owner of the specified context. If some other thread is the owner of the context, returns `FALSE` immediately. Ownership is properly recursive: the owner can require ownership again and will release ownership when `g_main_context_release()` is called as many times as g_main_context_acquire().

You must be the owner of a context before you can call g_main_context_prepare(), g_main_context_query(), g_main_context_check(), g_main_context_dispatch(), g_main_context_release().

Since 2.76 `context` can be `NULL` to use the global-default main context.

#### Return value

Type: `gboolean`

`TRUE` if the operation succeeded, and this thread is now the owner of `context`.