Re: glib main loop concept

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

 



On 10/3/07, Christian Buennig <masala@xxxxxx> wrote:
> I want to add IO watches to the default context in a library. Apps using
> the library may decide to start a main loop themselves (in the default
> context) or to let the library do this. Of course they could tell the
> library somehow if there already is a running main loop in the default
> context, but it would be nice if the library could detect this itself.

I'm not sure this is a good idea. I think a library has no place
starting main loops, unless they are completely isolated from the
(possible) application main loop. You are likely to cause confusion
and distress. A main loop should be started from an application's
main() and nowhere else (except for nested calls I guess).

I recommend you just add your IO watches to the default context (or
maybe have a parameter for context-to-add-the-watch-to, in the way
that glib does) and say in your documentation that the library user is
responsible for calling g_main_loop_run() or whatever.

(not that I'm a great expert on this)

John
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux