John Levon wrote: > On Tue, Mar 23, 2004 at 04:02:55PM +0000, Angus Leeming wrote: > >> Details follow below. Please try and rip it to shreds. > > Can't pick a hole in it. Looks fine to me
Magic. One thing I have been wondering about though. 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'?) An alternative to this strategy would be to 1. Reap the zombies in the child_handler function extern "C" void child_handler(int) { child_data & store = reaped_children[++current_child]; // Clean up the child process. store.pid = wait(&store.status); } 2. Use a Timeout to trigger checks of the 'reaped_children' store every second or so. That would mean that there was no change to the main GUI process loop at all, but that children are 'cleaned-up' in the signal handler. Which would you prefer? (And why!) (2) is a half-way house between (1) and (3) where (3) is what we have now, the Timeout being used to both reap the children and post the callbacks. I have no real feel for why one way is preferable to any other... -- Angus