123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::Dependencies::Interlock

Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/dependencies/interlock.rb

Class Method Summary

Instance Method Summary

Constructor Details

.newInterlock

This method is for internal use only.
[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 8

def initialize # :nodoc:
  @lock = ActiveSupport::Concurrency::ShareLock.new
end

Instance Method Details

#done_running

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 32

def done_running
  @lock.stop_sharing
end

#done_unloading

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 24

def done_unloading
  @lock.stop_exclusive(compatible: [:load, :unload])
end

#loading(&block)

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 12

def loading(&block)
  @lock.exclusive(purpose: :load, compatible: [:load], after_compatible: [:load], &block)
end

#permit_concurrent_loads(&block)

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 40

def permit_concurrent_loads(&block)
  @lock.yield_shares(compatible: [:load], &block)
end

#raw_state(&block)

This method is for internal use only.
[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 44

def raw_state(&block) # :nodoc:
  @lock.raw_state(&block)
end

#running(&block)

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 36

def running(&block)
  @lock.sharing(&block)
end

#start_running

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 28

def start_running
  @lock.start_sharing
end

#start_unloading

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 20

def start_unloading
  @lock.start_exclusive(purpose: :unload, compatible: [:load, :unload])
end

#unloading(&block)

[ GitHub ]

  
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 16

def unloading(&block)
  @lock.exclusive(purpose: :unload, compatible: [:load, :unload], after_compatible: [:load, :unload], &block)
end