jca has asked for the wisdom of the Perl Monks concerning the following question:
When run, this gives me...#!/usr/local/bin/perl -w use strict; $SIG{__DIE__} = sub {warn "uurk\n"; kill(9, -$$)}; if (my $pid=fork) { my $i=0; do { sleep 1; print "Parent thread ($$) - not dead yet...\n"; $i++; } until $i == 3; die; } elsif (defined $pid) { do { sleep 1; print "Child thread ($$) - not dead yet...\n"; } until 1 == 0; }
lovely - just what I wanted. So what if I call die from the child....bio-man@saturn [dbupdate] ./ugly_forker Parent thread (17387) - not dead yet... Child thread (17388) - not dead yet... Parent thread (17387) - not dead yet... Child thread (17388) - not dead yet... Parent thread (17387) - not dead yet... Child thread (17388) - not dead yet... uurk Killed bio-man@saturn [dbupdate]
This give me...#!/usr/local/bin/perl -w use strict; $SIG{__DIE__} = sub {warn "uurk\n"; kill(9, -$$)}; if (my $pid=fork) { do { sleep 1; print "Parent thread ($$) - not dead yet...\n"; } until 1 == 0; } elsif (defined $pid) { my $i=0; do { sleep 1; print "Child thread ($$) - not dead yet...\n"; $i++; } until $i == 3; die; }
Doh!...Anyone have any ideas on how to make a child take out the process group, and why this is not working?bio-man@saturn [dbupdate] ./ugly_forker Parent thread (19689) - not dead yet... Child thread (19690) - not dead yet... Parent thread (19689) - not dead yet... Child thread (19690) - not dead yet... Parent thread (19689) - not dead yet... Child thread (19690) - not dead yet... uurk Died at ./ugly_forker line 91. Parent thread (19689) - not dead yet... Parent thread (19689) - not dead yet... ^C bio-man@saturn [dbupdate]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parenticide...
by Abigail-II (Bishop) on Nov 27, 2002 at 12:07 UTC | |
|
Re: parenticide...
by iburrell (Chaplain) on Nov 27, 2002 at 17:23 UTC | |
by jca (Sexton) on Nov 28, 2002 at 10:02 UTC | |
|
Re: parenticide...
by Mr. Muskrat (Canon) on Nov 27, 2002 at 16:30 UTC |