Method

GLibMainContextinvoke

since: 2.28

Declaration [src]

void
g_main_context_invoke (
  GMainContext* context,
  GSourceFunc function,
  gpointer data
)

Description [src]

Invokes a function in such a way that context is owned during the invocation of function.

If context is NULL then the global-default main context — as returned by g_main_context_default() — is used.

If context is owned by the current thread, function is called directly. Otherwise, if context is the thread-default main context of the current thread and g_main_context_acquire() succeeds, then function is called and g_main_context_release() is called afterwards.

In any other case, an idle source is created to call function and that source is attached to context (presumably to be run in another thread). The idle source is attached with G_PRIORITY_DEFAULT priority. If you want a different priority, use g_main_context_invoke_full().

Note that, as with normal idle functions, function should probably return FALSE. If it returns TRUE, it will be continuously run in a loop (and may prevent this call from returning).

Available since: 2.28

This method is not directly available to language bindings.

Parameters

function

Type: GSourceFunc

Function to call.

data

Type: gpointer

Data to pass to function.

The argument can be NULL.
The data is owned by the caller of the method.