GLib.MainContext.acquire (original) (raw)

GLib

API Version: 2.0

Library Version: 2.85.0

Type

MainContext

Methods

acquire add_poll check dispatch find_source_by_funcs_user_data find_source_by_id find_source_by_user_data get_poll_func invoke invoke_full is_owner iteration pending pop_thread_default prepare push_thread_default pusher_new query ref release remove_poll set_poll_func unref wait wakeup

Generated by gi-docgen 2024.1

Method

GLibMainContextacquire

Declaration [src]


gboolean
g_main_context_acquire (
  GMainContext* context
)

Description [src]

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.