Fix a problem where multigcc.pl sometimes produces lines like "sh-elf-gcc: no input files", especially on systems with many cores and for builds with (relatively) few files. This happened because the slice size was rounded up, which meant that in some cases there werere leftover slices.

Also remove the now unnecessary cores>files checking.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27196 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2010-06-30 16:39:28 +00:00
parent 94aa0d741e
commit 40f33f0e30
1 changed files with 7 additions and 9 deletions

View File

@ -46,27 +46,25 @@ switch($^O) {
}
}
# don't run empty children
if (scalar @files <= $cores)
{
$cores = 1;
}
# fork children
my @pids;
my $slice = int((scalar @files + $cores) / $cores);
for my $i (0 .. $cores-1)
# reset $cores to 0 so we can count the number of actually used cores
$cores=0;
for (my $i=0;$i<scalar @files;$i += $slice)
{
my $pid = fork;
if ($pid)
{
# mother
$pids[$i] = $pid;
$pids[$cores++] = $pid;
}
else
{
# get my slice of the files
my @list = @files[$i * $slice .. $i * $slice + $slice - 1];
my @list = @files[$i .. $i + $slice - 1];
# run command
system("$command @list > $tempfile.$$");