develooper Front page | perl.perl5.porters | Postings from July 2011

[perldoc] where is cleanup_child function?

Thread Next
From:
BARBE David
Date:
July 19, 2011 16:11
Subject:
[perldoc] where is cleanup_child function?
Message ID:
4E260F05.5010805@csb.nc
Hi,
There is a problem with perldoc:
http://perldoc.perl.org/perlipc.html#Signals
Where is the detail of cleanup_child function in your code?

   1. use <http://perldoc.perl.org/functions/use.html> POSIX
      ":sys_wait_h"; # for nonblocking read
   2.
   3. my <http://perldoc.perl.org/functions/my.html> %children;
   4.
   5. $SIG{CHLD} = sub <http://perldoc.perl.org/functions/sub.html> {
   6. # don't change $! and $? outside handler
   7. local <http://perldoc.perl.org/functions/local.html> ($!, $?);
   8. my <http://perldoc.perl.org/functions/my.html> $pid = waitpid
      <http://perldoc.perl.org/functions/waitpid.html>(-1, WNOHANG);
   9. return <http://perldoc.perl.org/functions/return.html> if $pid == -1;
  10. return <http://perldoc.perl.org/functions/return.html> unless
      defined <http://perldoc.perl.org/functions/defined.html>
      $children{$pid};
  11. delete <http://perldoc.perl.org/functions/delete.html>
      $children{$pid};
  12. cleanup_child($pid, $?); #???
  13. };
  14.
  15. while (1) {
  16. my <http://perldoc.perl.org/functions/my.html> $pid = fork
      <http://perldoc.perl.org/functions/fork.html>();
  17. die <http://perldoc.perl.org/functions/die.html> "cannot fork"
      unless defined <http://perldoc.perl.org/functions/defined.html> $pid;
  18. if ($pid == 0) {
  19. # ...
  20. exit <http://perldoc.perl.org/functions/exit.html> 0;
  21. } else {
  22. $children{$pid}=1;
  23. # ...
  24. system <http://perldoc.perl.org/functions/system.html>($command);
  25. # ...
  26. }
  27. }

Thanks for your help.

David

Ce mél est à l'attention exclusive des destinataires désignés. Il peut contenir des informations confidentielles. Si vous le recevez par erreur, merci d'en informer sans délai l'expéditeur ou de le détruire. Toute utilisation de ce mél non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About