SYS V SIGCLD Handling

Conor P. Cahill cpcahil at virtech.uucp
Mon Nov 20 23:44:59 AEST 1989


In article <957 at sdrc.UUCP>, scjones at sdrc.UUCP (Larry Jones) writes:
> #include <signal.h>
> handler()
>    {    signal(SIGCLD, handler);    }
> 
> main()
>    {  signal(SIGCLD, handler);  if (fork() == 0) exit(0);   }
> 
> When I run this on my Sys Vr3.0 system, it goes into recursive
> death.  As soon as the handler calls signal to reestablish
> itself, it is immediately reinvoked.  Am I doing something wrong,

Yes.  You need to wait for the child in the handler.  If you have more
than one possible child, you need to wait for however many of them
there could be (usually you use alarm() to time out the wait).


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list