On Tuesday 23 March 2004 6:55 pm, John Levon wrote: > On Tue, Mar 23, 2004 at 06:46:12PM +0000, Angus Leeming wrote: > > Why don't you like > > while (!finished) { > > someNonTrivialFunction(); > > if (fl_check_forms() == FL_EVENT) { > > ... > > } > > } > > > > (I guess that this is what you call a 'busy loop'?) > > I think this is fine (assuming that fl_check_forms() only returns > when an event has happened).
Dunno about that. Should check. > Maybe I misunderstood what you wanted to change in Qt. A "busy > loop" would be one that chewed CPU despite no events arriving. This is what seems to happen in the Qt-equivalent. We get a never-ending stream of calls to 'someNonTrivialFunction()' when everything else is totally quiet. > > An alternative to this strategy would be to > > 1. Reap the zombies in the child_handler function > Isn't this what you described in your last mail which I said was > fine? Must be my poor-English day. The reaping the zombies bit is the same, but I was asking what is the best strategy to clean up after the children and post the callbacks to the rest of the code. Strategy 1 is to modify the main GUI loop, as above. Strategy 2 is to use a Timeout as we do currently, but use it only to post the callbacks of these 'reaped_children' rather than, as now, using it to both reap the zombies AND post the callbacks. Basically, I'm at a bit of a loss. The reaping-children bit appears to be optimized as the handler is invoked only when a SIGCHLD event is emitted. It seems to be a real pity that we can't be similarly efficient when posting the callbacks. Angus