Re: How to maintain responsiveness during long functions?

On Fri, Jun 25, 1999 at 07:40:52AM +0800, James Henstridge wrote:
> The ideal solution is to split up the working into small chunks and get an
> idle function to take care of it.

This is what I thought; unfortunately, this has the drawback of
requiring me to actually /understand/ the code that people have gifted
to me ... :-)

> The other solution is to call the following code during the working every
> now and again:
>   if (gtk_events_pending())
>     gtk_main_iteration();

This is what I initially tried, from stumbling through header files
looking for answers.

> In general, I have found that the first solution runs faster and gives a
> more responsive interface, but requires a bit more thinking to implement
> correctly.  (It also has the advantage that it is easier to cancel the
> thinking, if that is important).

Yes, the second solution is not optimal from a responsiveness point of
view, and does slow down the algorithm somewhat.  Also, quitting the
program doesn't work, which follows when I tracked down how
gtk_main_quit() actually goes about quitting.  I wonder if there's any
way around this, though ...

Thanks for the help, and if you've got any thoughts on how to safely
make Exit work with the easy option, I'd be very grateful again.

I should learn never to expect an easy answer ... :-)

Ian Peters  | GnuPG Key ID 5C23D20C    | "He that breaks a thing to find out | E584 2558 FAC3 BEAB EFAC |  what it is has left the path of | FC74 CFED 7E24 5C23 D20C |  wisdom." -- J.R.R. Tolkien

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