On Fri, Mar 19, 2004 at 06:21:16PM +0000, Angus Leeming wrote: > Attached is a patch to use the SIGCHLD signal instead of this Timeout. The
Good man. You made the UNIX bunnies happy (that is, me). > static void child_handler(int err_sig) > { > switch (err_sig) { > case SIGCHLD: > lyxerr << "\nlyx: SIGCHLD signal caught" << endl; > ForkedcallsController::get().timer(); > break; > default: > lyxerr << "\nlyx: warning! Unexpected signal caught!" > << err_sig << endl; > } > } Nope. > Or should the code in child_handler be truly trivial: Yes. > static bool sigchild_received = false; static sigatomic_t signchild_received > static void child_handler(int err_sig) > { > switch (err_sig) { > case SIGCHLD: > sigchild_received = true; > break; > default: > lyxerr << "\nlyx: warning! Unexpected signal caught!" > << err_sig << endl; > } > } > > Leaving the handling of sigchild_received to someplace outside of the > handler? That's correct. Very (very) few system calls are usable in a signal context. This includes anything printf-like. You can refer to the UNIX standards for more info, but basically, setting a sigatomic_t variable to TRUE or equivalent is the way to go. cheers, john -- "Spammers get STABBED by GOD." - Ron Echeverri