MainContext.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.

class MainContext
bool
acquire
()

Return Value

Type: bool

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