MainContext.acquire

bool acquire()

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 [glib.main_context.MainContext.release] is called as many times as [glib.main_context.MainContext.acquire].

You must be the owner of a context before you can call [glib.main_context.MainContext.prepare], [glib.main_context.MainContext.query], [glib.main_context.MainContext.check], [glib.main_context.MainContext.dispatch], [glib.main_context.MainContext.release].

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

Returns

true if the operation succeeded, and

this thread is now the owner of context.