123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::Concurrency::LoadInterlockAwareMonitor

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Monitor
Instance Chain:
self, Monitor
Inherits: Monitor
  • ::Object
Defined in: activesupport/lib/active_support/concurrency/load_interlock_aware_monitor.rb

Overview

A monitor that will permit dependency loading while blocked waiting for the lock.

Constant Summary

Instance Method Summary

Instance Method Details

#mon_enter

Enters an exclusive section, but allows dependency loading while blocked

[ GitHub ]

  
# File 'activesupport/lib/active_support/concurrency/load_interlock_aware_monitor.rb', line 15

def mon_enter
  mon_try_enter ||
    ActiveSupport::Dependencies.interlock.permit_concurrent_loads { super }
end

#synchronize

[ GitHub ]

  
# File 'activesupport/lib/active_support/concurrency/load_interlock_aware_monitor.rb', line 20

def synchronize
  Thread.handle_interrupt(EXCEPTION_NEVER) do
    mon_enter

    begin
      Thread.handle_interrupt(EXCEPTION_IMMEDIATE) do
        yield
      end
    ensure
      mon_exit
    end
  end
end