Struct

GLibMainContext

Description [src]

struct GMainContext {
  /* No available fields */
}

The GMainContext struct is an opaque data type representing a set of sources to be handled in a main loop.

Constructors

g_main_context_new

Creates a new GMainContext structure.

g_main_context_new_with_flags

Creates a new GMainContext structure.

since: 2.72

Functions

g_main_context_default

Returns the global-default main context.

g_main_context_get_thread_default

Gets the thread-default main context for this thread.

since: 2.22

g_main_context_pusher_free

Pop pusher’s main context as the thread default main context. See g_main_context_pusher_new() for details.

since: 2.64

g_main_context_ref_thread_default

Gets a reference to the thread-default GMainContext for this thread.

since: 2.32

Instance methods

g_main_context_acquire

Tries to become the owner of the specified context.

g_main_context_add_poll

Adds a file descriptor to the set of file descriptors polled for this context.

g_main_context_check

Passes the results of polling back to the main loop.

g_main_context_dispatch

Dispatches all pending sources.

g_main_context_find_source_by_funcs_user_data

Finds a source with the given source functions and user data.

g_main_context_find_source_by_id

Finds a GSource given a pair of context and ID.

g_main_context_find_source_by_user_data

Finds a source with the given user data for the callback.

g_main_context_get_poll_func

Gets the poll function set by g_main_context_set_poll_func().

g_main_context_invoke

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

since: 2.28

g_main_context_invoke_full

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

since: 2.28

g_main_context_is_owner

Determines whether this thread holds the (recursive) ownership of this GMainContext.

since: 2.10

g_main_context_iteration

Runs a single iteration for the given main loop.

g_main_context_pending

Checks if any sources have pending events for the given context.

g_main_context_pop_thread_default

Pops context off the thread-default context stack (verifying that it was on the top of the stack).

since: 2.22

g_main_context_prepare

Prepares to poll sources within a main loop.

g_main_context_push_thread_default

Acquires context and sets it as the thread-default context for the current thread. This will cause certain asynchronous operations (such as most Gio-based I/O) which are started in this thread to run under context and deliver their results to its main loop, rather than running under the global default main context in the main thread. Note that calling this function changes the context returned by g_main_context_get_thread_default(), not the one returned by g_main_context_default(), so it does not affect the context used by functions like g_idle_add().

since: 2.22

g_main_context_pusher_new

Push main_context as the new thread-default main context for the current thread, using g_main_context_push_thread_default(), and return a new GMainContextPusher. Pop with g_main_context_pusher_free(). Using g_main_context_pop_thread_default() on main_context while a GMainContextPusher exists for it can lead to undefined behaviour.

since: 2.64

g_main_context_query

Determines information necessary to poll this main loop.

g_main_context_ref

Increases the reference count on a GMainContext object by one.

g_main_context_release

Releases ownership of a context previously acquired by this thread with g_main_context_acquire().

g_main_context_remove_poll

Removes file descriptor from the set of file descriptors to be polled for a particular context.

g_main_context_set_poll_func

Sets the function to use to handle polling of file descriptors.

g_main_context_unref

Decreases the reference count on a GMainContext object by one. If the result is zero, free the context and free all associated memory.

g_main_context_wait

Tries to become the owner of the specified context, and waits on cond if another thread is the owner.

deprecated: 2.58 

g_main_context_wakeup

Wake up context if it’s currently blocking in g_main_context_iteration(), causing it to stop blocking.