sagar_kempe has asked for the wisdom of the Perl Monks concerning the following question:
if (!defined($kidpid = fork())){ # fork returned undef, so failed die "cannot fork: $!"; }elsif ($kidpid == 0) { # fork returned 0, so this branch is the child $TestResult = &$TEST_PROCESS($_[0], $_[1]); # &$TEST_PROCESS is a subroutine that is written in some other file th +at will return 1 if success exit; # terminate the child thread... } else { for ($timer=0;$timer<=$TEST_TIMEOUT;$timer++) {
Here I want to check the status of the child process .i.e. if it is running or not. If the child process does not end before $TEST_TIMEOUT(defined in another script) I want to kill the child process.
The only problem I face is how to check the status of the child process.
Can i share a varible between the child & parent process that will get updated when the child process completes?
} }
Edited by planetscape - fixed code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: is sharing variables between forked process possible??
by salva (Canon) on Feb 17, 2006 at 09:15 UTC | |
|
Re: is sharing variables between forked process possible??
by acid06 (Friar) on Feb 17, 2006 at 18:56 UTC | |
|
Re: is sharing variables between forked process possible??
by vennirajan (Friar) on Feb 17, 2006 at 07:17 UTC | |
by salva (Canon) on Feb 17, 2006 at 09:27 UTC | |
by Steve_p (Priest) on Feb 17, 2006 at 14:42 UTC | |
by earlati2 (Beadle) on Feb 17, 2006 at 09:17 UTC | |
by zentara (Cardinal) on Feb 17, 2006 at 13:36 UTC | |
by zentara (Cardinal) on Feb 17, 2006 at 13:17 UTC |