glib main loop



Hi!

I am doing some development with the glib2.0 main loop (no gtk), or i
am trying to do so, at least.

I want to register a function which is called after each completed
iteration of a main loop. 

An example: I have a main context with four or five distinct attached
sources. if any of these get triggered, some cleanup work is needed
after their execution. If three of them are dispatched in an iteration
i want to have my cleanup function just called afterwords once.

is this doable with glib2.0 without quirky hacks?

I thought of doing my own main loop and just calling
gmain_context_iteration() like the following:

for (;;) {
  g_main_context_iteration(NULL, TRUE);
  do_my_cleanups();
}

Is that the "official" way to achieve this?

Is there any further documentation available about the glib2.0 main
loop? (in addition to
http://developer.gnome.org/doc/API/2.0/glib/index.html)

Thank you,
 Lennart

-- 
name { Lennart Poettering } mail { lennart poettering de }
icq { 11060553 } www { http://www.poettering.de/lennart/ }
loc { hamburg, germany } pgp { 0x1A015CC4 } hack { .phi. }

Attachment: pgpUv8Yca4YTC.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]