MainLoop

The GMainLoop struct is an opaque data type representing the main event loop of a GLib or GTK+ application.

Constructors

this
this(GMainLoop* gMainLoop, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(MainContext context, bool isRunning)

Creates a new #GMainLoop structure.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

doref
MainLoop doref()

Increases the reference count on a #GMainLoop object by one.

getContext
MainContext getContext()

Returns the #GMainContext of @loop.

getMainLoopStruct
GMainLoop* getMainLoopStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

isRunning
bool isRunning()

Checks to see if the main loop is currently being run via g_main_loop_run().

quit
void quit()

Stops a #GMainLoop from running. Any calls to g_main_loop_run() for the loop will return.

run
void run()

Runs a main loop until g_main_loop_quit() is called on the loop. If this is called for the thread of the loop's #GMainContext, it will process events from the loop, otherwise it will simply wait.

unref
void unref()

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

Static functions

mainCurrentSource
Source mainCurrentSource()

Returns the currently firing source for this thread.

mainDepth
int mainDepth()

Returns the depth of the stack of calls to g_main_context_dispatch() on any #GMainContext in the current thread. That is, when called from the toplevel, it gives 0. When called from within a callback from g_main_context_iteration() (or g_main_loop_run(), etc.) it returns 1. When called from within a callback to a recursive call to g_main_context_iteration(), it returns 2. And so forth.

poll
int poll(GPollFD* fds, uint nfds, int timeout)

Polls @fds, as with the poll() system call, but portably. (On systems that don't have poll(), it is emulated using select().) This is used internally by #GMainContext, but it can be called directly if you need to block until a file descriptor is ready, but don't want to run the full main loop.

Variables

gMainLoop
GMainLoop* gMainLoop;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta