I'm trying to use Perl for loadtesting purposes, which means that I need to run simultaneous processes and then return for stat gathering. Now I have the process forking working, but my problem is returning to gather the stats. I am using the following code to wait for all child processes to finish, and to be doubly sure I'm killing the processes after they finish:
1 while wait() > 0;
foreach my $child (keys %pid) {
kill($child);
}
The idea was that I could kill the child processes and continue with subsequent code. Unfortunately, that's not what's happening. The child process does not end until it has run a full instance of the program (including the above code and any subsequent code). The end result of this is that any code after the forks is being run multiple times.
Is there any way around this? How do I Fork multiple parralel processes and then return to a single process? An added complication is that this needs to run on a vanilla Test System (Solaris Sybase) without adding any Perl Modules or configuring for threading.
Any help much appreciated!
Thanks,
Alatar
In reply to Continuing a program after Forking by Alatar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |