GLib.MainContext.prototype.acquire

function acquire(): Boolean {
    // Gjs wrapper for g_main_context_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.MainContext.prototype.release is called as many times as GLib.MainContext.prototype.acquire.

You must be the owner of a context before you can call GLib.MainContext.prototype.prepare, GLib.MainContext.prototype.query, GLib.MainContext.prototype.check, GLib.MainContext.prototype.dispatch.

Returns

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