wmakeLnIncludeAll: Use 'wait -n' rather than and arbitrary 'sleep' when limiting the number of jobs
This commit is contained in:
parent
8e900af6e3
commit
911e424515
2 changed files with 11 additions and 18 deletions
|
|
@ -157,4 +157,12 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Cleanup local variables and functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
unset Script usage
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -117,12 +117,13 @@ do
|
||||||
then
|
then
|
||||||
# If running in parallel start wmakeLnInclude on nCores
|
# If running in parallel start wmakeLnInclude on nCores
|
||||||
# and more as the cores become free
|
# and more as the cores become free
|
||||||
if [ "$nCores" -gt 0 ]
|
if [ "$nCores" > 0 ]
|
||||||
then
|
then
|
||||||
joblist=($(jobs -p))
|
joblist=($(jobs -p))
|
||||||
while (( ${#joblist[*]} > $nCores ))
|
while (( ${#joblist[*]} > $nCores ))
|
||||||
do
|
do
|
||||||
sleep 0.01
|
# When the job limit is reached wait for a job to finish
|
||||||
|
wait -n
|
||||||
joblist=($(jobs -p))
|
joblist=($(jobs -p))
|
||||||
done
|
done
|
||||||
wmakeLnInclude -update $topDir &
|
wmakeLnInclude -update $topDir &
|
||||||
|
|
@ -138,22 +139,6 @@ do
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# If running in parallel wait until all wmakeLnInclude jobs are complete
|
|
||||||
if [ "$nCores" -gt 0 ]
|
|
||||||
then
|
|
||||||
for job in $(jobs -p)
|
|
||||||
do
|
|
||||||
echo $job
|
|
||||||
wait $job || let "FAIL+=1"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$FAIL" == "0" ];
|
|
||||||
then
|
|
||||||
echo "$Script: completed wmakeLnInclude processes"
|
|
||||||
else
|
|
||||||
echo "$Script: failed ($FAIL)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Cleanup local variables and functions
|
# Cleanup local variables and functions
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue