class ActiveSupport::Concurrency::ShareLock

def wait_for(method)

def wait_for(method)
  @sleeping[Thread.current] = method
  @cv.wait_while { yield }
ensure
  @sleeping.delete Thread.current
end