class Concurrent::RubyThreadLocalVar

def self.thread_finalizer(array)

@!visibility private
def self.thread_finalizer(array)
  proc do
    Thread.new do # avoid error: can't be called from trap context
      LOCK.synchronize do
        # The thread which used this thread-local array is now gone
        # So don't hold onto a reference to the array (thus blocking GC)
        ARRAYS.delete(array.object_id)
      end
    end
  end
end