MainLoop


Object Hierarchy:

GLib.MainLoop GLib.MainLoop GLib.MainLoop

Description:

[ Compact ]
[ CCode ( ref_function = "g_main_loop_ref" , type_id = "G_TYPE_MAIN_LOOP" , unref_function = "g_main_loop_unref" ) ]
public class MainLoop

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

Example: MainLoop:

public static int main (string[] args) {
MainLoop loop = new MainLoop ();
TimeoutSource time = new TimeoutSource (2000);

time.set_callback (() => {
print ("Time!\n");
loop.quit ();
return false;
});

time.attach (loop.get_context ());

loop.run ();
return 0;
}

valac --pkg glib-2.0 GLib.MainLoop.vala


Namespace: GLib
Package: glib-2.0

Content:

Creation methods:

Methods: