Re: Changes to the GLib main loop [ g_main_iterate() ]



Hi Joshua

> > > I'd tend to agree that the structure should be:
> > >
> > >  * One thread handles incoming events, and dispatches all slow
> > >    operations to other threads.
> > >
> > > It's not the only way people try to write things, but probably we
> > > just need to educate people.
> >
> > Yes. Also I don't think, this is something that people will often use
> > in normal applications. So that shouldn't be a problem.
> 
> For what it's worth, i wrote an event loop for Perl.  The code is blind
> to threads because i don't know how is it possible to improve upon:
> 
>   "One thread handles incoming events, and dispatches all slow
>    operations to other threads."

I fully agree, that's also how I solved that for ORBit-mt.

The point of our discussion is a bit different, because you can use
g_main_context_iterate or better g_main_context_run not only to dispatch
events, but also to just wait for all events being dispatched and/or the main
loop being terminated, and that is very well interesting for other threads
too.

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi




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