oop_glib_new(), oop_glib_delete(), oop_glib_return()

#include <oop.h>
#include <glib.h>
#include <oop-glib.h>

oop_source *oop_glib_new();
void oop_glib_delete();
void *oop_glib_return();


Create a liboop source which uses the GLib Main Event Loop for events. There is only one such event loop (the GMainLoop structure really represents a loop context, not a fully independent event loop), so this function is global. You may call it multiple times; it will return the same event source, but keep count of the number of users.

Events will be dispatched when the GLib event loop is run, either directly via g_main_run() or indirectly via gtk_main().

Delete the liboop source created with oop_glib_new(). This decrements the count of users; when oop_glib_delete has been called as many times as oop_glib_new, the event source is removed.

Since the event source is run by GLib, the main program has no direct way of retrieving a value returned by an event handler. Instead, when the loop is terminated, the GLib event loop should return, and the caller can use this function to request the specific termination code.

This function isn't commonly used. Furthermore, GLib event loop termination does not currently work. In other words, ignore this for now.

liboop reference