summaryrefslogtreecommitdiff
path: root/pod/perlipc.pod
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2013-07-12 17:12:46 +1000
committerTony Cook <tony@develop-help.com>2013-07-19 12:03:43 +1000
commitfd4402024b24e2932365e29708532aff07b488af (patch)
treec0d882b7ad835a4701e6c2a74feacd49f3fd012d /pod/perlipc.pod
parente6afd14589235a50ef7aa8ed0ed8c685dd3116d3 (diff)
downloadperl-fd4402024b24e2932365e29708532aff07b488af.tar.gz
handle multiple children exiting in perlipc example
Diffstat (limited to 'pod/perlipc.pod')
-rw-r--r--pod/perlipc.pod9
1 files changed, 4 insertions, 5 deletions
diff --git a/pod/perlipc.pod b/pod/perlipc.pod
index 69567e937b..decb59b858 100644
--- a/pod/perlipc.pod
+++ b/pod/perlipc.pod
@@ -124,11 +124,10 @@ example:
$SIG{CHLD} = sub {
# don't change $! and $? outside handler
local ($!, $?);
- my $pid = waitpid(-1, WNOHANG);
- return if $pid == -1;
- return unless defined $children{$pid};
- delete $children{$pid};
- cleanup_child($pid, $?);
+ while ( (my $pid = waitpid(-1, WNOHANG)) > 0 ) {
+ delete $children{$pid};
+ cleanup_child($pid, $?);
+ }
};
while (1) {