System V and SIGCLD

Lindsay F. Marshall lindsay at cheviot.uucp
Mon May 12 20:59:40 AEST 1986


In article <344 at hrc63.UUCP> nwh at hrc63.UUCP (Nigel Holder Marconi) writes:
>
>   The problem with resetng SIGCLD is that the signal is still valid since
>the child process is waiting for the parent to perform a wait.  The following
>implements this and of course works !
>......
>		wait(&c);

This is, of course, perfectly obvious, but DOESNT ANSWER MY QUESTION!!
In the application I have I MUST not do a wait inside the signal handler.
The solution of adding wait has been suggested by many people, but it
simply is no good. If you want to save status information you then have
to implement a stack wait return data, and then a new verion of wait that
looks at the stack to see if anything has terminated etc. etc. The bottom
line is that SIGCLD is very broken and ougth to be fixed!! One way round
this problem if you are only expecting SIGCLD's to come in ones is to put

	signal(SIGCLD, SIG_IGN);

before you reset the signal. This cause any outstanding SIGCLD's to be
junked (hence it only works when there is a single child) but does allow
you to reset the signal for future parent/child interactions withou causing
an infinite loop.



More information about the Comp.unix.wizards mailing list