yicstone has asked for the wisdom of the Perl Monks concerning the following question:

Is it necessary that I must get ready for processing the
signal CHLD in parent if I call the function fork()?

Replies are listed 'Best First'.
RE: Is it necessary?
by lhoward (Vicar) on May 01, 2000 at 02:31 UTC
    If you are spawning processes and aren't waiting (or don't want to wait/watch) for them to complete (either by waitpid or another method) you can use

    $SIG{CHLD}='IGNORE';
    to explicitly ignore SIG_CHLD signals. This will precent zombie processes from being created. (code taken from Perl Cookbook).


    Les Howard
    www.lesandchris.com
    Author of Net::Syslog and Number::Spell

Re: Is it necessary?
by merlyn (Sage) on Apr 30, 2000 at 18:46 UTC
    No... if you don't catch it, it's merely ignored. But what's your real question? Why would you be thinking about SIGCHLD? -- Randal L. Schwartz, Perl hacker
Re: Is it necessary?
by perlmonkey (Hermit) on Apr 30, 2000 at 22:18 UTC
    You dont need the worry about SIGCHLD as Randal said. You probably should include either a wait or a waitpid function call, so your child process does not become a zombie.

    See another discussion on forking