Function

GLibMainContextget_thread_default

since: 2.22

Declaration [src]

GMainContext*
g_main_context_get_thread_default (
  void
)

Description [src]

Gets the thread-default GMainContext for this thread. Asynchronous operations that want to be able to be run in contexts other than the default one should call this method or g_main_context_ref_thread_default() to get a GMainContext to add their GSources to. (Note that even in single-threaded programs applications may sometimes want to temporarily push a non-default context, so it is not safe to assume that this will always return NULL if you are running in the default thread.)

If you need to hold a reference on the context, use g_main_context_ref_thread_default() instead.

Available since: 2.22

Return value

Type: GMainContext

The thread-default GMainContext, or NULL if the thread-default context is the global-default main context.

The data is owned by the called function.
The return value can be NULL.