acquire


Description:

public 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 [method@GLib.MainContext.release] is called as many times as [method@GLib.MainContext.acquire].

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

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

Parameters:

this

a main context (if `NULL`, the global-default main context will be used)

Returns:

true if this thread is now the owner of this, false otherwise