M
mrstevegross
Hi folks. I need to launch two "background" processes and wait for
them both to finish before proceeding. I have followed the advice
elsewhere on this forum to use the fork & wait solution. Here's what I
have so far:
my $proc1_pid = fork;
if(not $proc1_pid) {
exec("proc1");
}
my $proc2_pid = fork;
if(not $proc2_pid) {
exec("proc1");
}
wait();
doSomething();
Unfortunately, wait() doesn't appear to work--the doSomething() line
is processed immediately, even though proc1 and proc2 have not
terminated.
Am I doing something wrong? Is there something quirky about having two
background processes instead of one?
Thanks,
--Steve
them both to finish before proceeding. I have followed the advice
elsewhere on this forum to use the fork & wait solution. Here's what I
have so far:
my $proc1_pid = fork;
if(not $proc1_pid) {
exec("proc1");
}
my $proc2_pid = fork;
if(not $proc2_pid) {
exec("proc1");
}
wait();
doSomething();
Unfortunately, wait() doesn't appear to work--the doSomething() line
is processed immediately, even though proc1 and proc2 have not
terminated.
Am I doing something wrong? Is there something quirky about having two
background processes instead of one?
Thanks,
--Steve