Thanks for the reply. But even without exit, i face the same issue.
Even if i use threads instead of fork, my main program exits even though the threads have not finished. I am not very well with debugging efforts in perl. With threads, the code looks something like this.
my @threads;
for ( my $count = 1; $count <= 10; $count++) {
my ( $lines,@cnArray) = getLineCount($count);
my $t = threads->create(\&sub1, $count, $lines, \@cnArray);
push(@threads,$t);
}
foreach my $thr_num (@threads) {
while ($thr_num->is_running()) {
sleep(10);
}
if ($thr_num->is_joinable()) {
$thr_num->join();
}
}
In reply to Re^2: Main program exits even before the child process completes on windows
by vivekarcot
in thread Main program exits even before the child process completes on windows
by vivekarcot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |