class Concurrent::AbstractLocals

def next_index(local)

def next_index(local)
  index = synchronize do
    if @free.empty?
      @next += 1
    else
      @free.pop
    end
  end
  # When the local goes out of scope, we should free the associated index
  # and all values stored into it.
  ObjectSpace.define_finalizer(local, local_finalizer(index))
  index
end