Re: glib main loop concept



On 10/3/07, jcupitt gmail com <jcupitt gmail com> wrote:
> On 10/3/07, Christian Buennig <masala web de> 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).

That's very similar to what I'm doing right now. You can do this, but
as jcupitt said, do not interact with the main loop from your library,
let the application do that.

If you want events such as your IO watches to reach into libraries
you've loaded, have the libraries connect to the appropriate signals,
and the glib main loop will do the rest.

-- 
http://www.socsurveys.org/
http://blogger.socsurveys.org/
http://del.icio.us/hdon



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