sdl3 has asked for the wisdom of the Perl Monks concerning the following question:
The interrupt handler is:sub ProcessPing { my ($Id, $IpAddr, $Command) = @_; $pingobject = Net::Ping->new(icmp,1); if ($child_pid = fork()) { #We must be the parent process return $child_pid; } elsif (defined $child_pid) { # We must be the child process $SIG{TERM} = \&int_handler ; #Since we are the child set up a #Signal handler. TERM was chosen #to try and eliminate memory cons +umption. while (1) { if ($pingobject->ping($IpAddr)) { print "Ping successfull to $IpAddr for Id $Id\n"; sleep 1; } else { print "Ping timeout occured on $IpAddr for Id $Id\n"; } } } }
And the kill command used in another part of the program is: kill ("TERM", $child_pid_to_kill); When the signal is missed I do not see the output from the debug statement: print "Caught the signal!!!!!!!!!!!!!!\n";sub int_handler { #Only called by the child. print "Caught the signal!!!!!!!!!!!!!!\n"; my $signal = shift; die "Caught the signal, Exiting!!!\n"; }
Another interesting tidbit is if I switch the signal used to KILL the child dies everytime! Any ideas? Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Child not Consistantly Terminating
by Abigail-II (Bishop) on Feb 19, 2004 at 12:03 UTC | |
by sdl3 (Novice) on Feb 19, 2004 at 13:05 UTC | |
by Abigail-II (Bishop) on Feb 19, 2004 at 15:03 UTC | |
|
Re: Child not Consistantly Terminating
by BrowserUk (Patriarch) on Feb 19, 2004 at 15:14 UTC | |
by sdl3 (Novice) on Feb 20, 2004 at 12:12 UTC | |
|
Re: Child not Consistantly Terminating
by mutated (Monk) on Feb 19, 2004 at 13:13 UTC | |
by sdl3 (Novice) on Feb 19, 2004 at 14:00 UTC | |
|
Re: Child not Consistantly Terminating
by flyingmoose (Priest) on Feb 19, 2004 at 14:23 UTC | |
by tbone1 (Monsignor) on Feb 19, 2004 at 14:31 UTC | |
|
Re: Child not Consistantly Terminating
by eyepopslikeamosquito (Archbishop) on Feb 20, 2004 at 12:15 UTC |