Re: Screen updates while long time running subroutine



Jeroen Benckhuijsen <jfbenck home nl> writes:
> On 16 Jul 2001 23:21:07 +0000, Eric Smith wrote:
> > I'm working on a simulator, and had been trying to run the
> > simulation from idle callbacks.  Each idle callback will run the
> > simulation for a while then return.
> > 
> > It just occurred to me to wonder, if things are idle, Should I expect my
> > idle callback function be executed repeatedly?  Or does each installed
> > idle callback function only get called once per "idle period"?

The idle function will be called over and over. 

> > Which describes using a statement like
> > 
> > 	while (g_main_iteration(FALSE));
> > 
> > in the midst of functions that do length calculations.
> > 
> > Am I better off using this method rather than idle callbacks?
> > 
> > What is the difference between that, and:
> > 
> > 	while (gtk_events_pending())
> > 	  gtk_main_iteration();


I would use idle callbacks instead; it's a bit more elegant and more
correct when it's possible to do it that way.

The two while loops above are equivalent; the gtk_ one is the old way
to do it, and the g_main_ one is the new way to do it. The gtk_ one
just ends up doing the g_main_ one internally.

Havoc





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