develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #113028] [PATCH] Full example of REAPER in perlipc

Thread Previous
Tony Cook via RT
June 24, 2013 02:21
[perl #113028] [PATCH] Full example of REAPER in perlipc
Message ID:
On Fri May 25 06:08:13 2012, worldmind wrote:
> Птн. Май 25 04:21:50 2012, LeonT писал:
> > On Tue, May 22, 2012 at 5:05 PM, Leon Timmermans <> 
> > On second reading, that does not seem necessary. The process will
> > receive a sigchild under these circumstances, but waitpid will ignore
> > that status unless asked for it (using the WUNTRACED and WCONTINUE
> > options).
> As I understand you say that we can skip WIFEXITED($?) and
> WIFSIGNALED($?) checking, but we will get STOP signal and process it
> like child exiting.
> Simple example in attached file:

I don't think this answers Leon's objection - waitpid() will only return
the child process id on a STOP if you supply WUNTRACED in options.

If you modify your code to check waitpid:

$SIG{CHLD} = sub {
  my $pid = waitpid(-1, WNOHANG);
  if ($pid > 0) {
    warn 'Get CHLD signal ', $pid;

then you don't get the warning on a STOP.

That said, the waitpid() loop is required (which the cookbook doesn't
seem to use.)


via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About