I have been experimenting to figure out how to use the threads module
and I have run into a problem that I can not figure out. I need to call
an executable program multiple times and I will then need to process
the returns to stdout. If I run the following code with the system
command there are no problems.
use strict;
use warnings;
use Env;
use POSIX;
use Thread;
my $thr1 = new Thread \&sub1, "vsim_1133390003.fcdb";
my $thr2 = new Thread \&sub1, "vsim_1133390008.fcdb";
my $thr3 = new Thread \&sub1, "vsim_1133390025.fcdb";
foreach my $thr (threads->list) {
my @ReturnData = $thr->join;
print "Thread returned @ReturnData\n";
}
sub sub1 {
my @InboundParameters = @_;
my $FileName = $InboundParameters[0];
print "Processing $FileName\n";
my $sys = system "vcover stats $FileName";
return 1 ;
}
However I need to get hold of the return information from the vcover
command that I run from system. system() itself doesn't return the
stdout so I have to use
the 'tick method I believe. However as soon as I change the line above
in sub1 to be :
my @value = `vcover stats $FileName `;
The script hangs. I have added a redirect to the vcover command and
know that they are all running and finish ok, but they still hang the
script every time. Does anybody have any ideas ?
Many Thanks
Darron