aboutsummaryrefslogtreecommitdiff
path: root/xlat/gen.sh
diff options
context:
space:
mode:
Diffstat (limited to 'xlat/gen.sh')
-rwxr-xr-xxlat/gen.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/xlat/gen.sh b/xlat/gen.sh
index 06c1b17a9..d5286d105 100755
--- a/xlat/gen.sh
+++ b/xlat/gen.sh
@@ -290,6 +290,7 @@ main()
local name
local jobs=0
local ncpus="$(getconf _NPROCESSORS_ONLN)"
+ local pids=
[ "${ncpus}" -ge 1 ] ||
ncpus=1
@@ -300,15 +301,20 @@ main()
name=${f##*/}
name=${name%.in}
gen_header "${f}" "${output}/${name}.h" "${name}" &
+ pids="$pids $!"
names="${names} ${name}"
: $(( jobs += 1 ))
- if [ ${jobs} -ge ${ncpus} ]; then
- jobs=0
- wait
- fi
+ if [ "${jobs}" -gt "$(( ncpus * 2 ))" ]; then
+ read wait_pid rest
+ pids="$rest"
+ wait -n 2>/dev/null || wait "$wait_pid"
+ : $(( jobs -= 1 ))
+ fi <<- EOF
+ $pids
+ EOF
done
- gen_git "${output}/.gitignore" ${names}
- gen_make "${output}/Makemodule.am" ${names}
+ gen_git "${output}/.gitignore" ${names} &
+ gen_make "${output}/Makemodule.am" ${names} &
wait
else
name=${input##*/}