# File lib/rumai/ixp/transport.rb, line 64 def obtain until member = @lock.synchronize { @pool.shift } # the pool is empty, so fill it @lock.synchronize do FILL_RATE.times do if @pos != @lim @pool.push @pos @pos = @pos.succ else break end end end or Thread.pass # range is exhausted, so wait for other threads to fill the pool end member end