module ActiveSupport::Concurrency::LoadInterlockAwareMonitorMixin

def mon_enter

Enters an exclusive section, but allows dependency loading while blocked
def mon_enter
  mon_try_enter ||
    ActiveSupport::Dependencies.interlock.permit_concurrent_loads { super }
end

def synchronize(&block)

def synchronize(&block)
  Thread.handle_interrupt(EXCEPTION_NEVER) do
    mon_enter
    begin
      Thread.handle_interrupt(EXCEPTION_IMMEDIATE, &block)
    ensure
      mon_exit
    end
  end
end