AtOM/lib/workers/getworkerid
2013-04-08 02:52:56 +02:00

16 lines
279 B
Bash

#!/bin/bash
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-- ))
}