MainContext.getThreadDefault

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 glib.main_context.MainContext.refThreadDefault 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 glib.main_context.MainContext.refThreadDefault instead.

class MainContext
static
getThreadDefault
()

Return Value

Type: glib.main_context.MainContext

the thread-default #GMainContext, or null if the thread-default context is the global-default main context.