Portable SIGCHLD/SIGCLD use?

Spencer W. Thomas spencer at eecs.umich.edu
Fri May 17 01:09:10 AEST 1991


I've spent most of my time programming on BSD systems, but I find myself
in the position of writing a handler for SIGCHLD/SIGCLD that must be as
portable as possible.  What is the best way to do this?  The possibility
that occurs to me is

sig_cld_h()
{
	(void)signal( SIGCLD, sig_cld_h );
	(void)wait( (void *)0 );
}

Clearly, this is not the best, but it should work.  I guess there is
a race condition that could lose a signal if another child exits after the 
signal is delivered but before the handler is invoked.  Is there anything 
better one can do without wait3()?

Please respond by mail.  Thank you.
-- 
=Spencer W. Thomas 		EECS Dept, U of Michigan, Ann Arbor, MI 48109
spencer at eecs.umich.edu		313-936-2616 (8-6 E[SD]T M-F)



More information about the Comp.unix.programmer mailing list