AtOM/lib/workers/getworkerid
2013-04-07 01:27:07 +02:00

15 lines
267 B
Plaintext

getworkerid() {
local i
for (( i=0 ; i >= 0 ; i++ ))
do
if [ -z "${workers[i]}" ]
then
echo $i
return
fi
done
# If we reach this, we have reached the signed long limit
# (2^63 - 1 = 9223372036854775807 - Got a supercomputer?)
(( concurrency-- ))
}