Class: ActiveSupport::Dependencies::Interlock
Relationships & Source Files | |
Inherits: | Object |
Defined in: | activesupport/lib/active_support/dependencies/interlock.rb |
Class Method Summary
- .new ⇒ Interlock constructor Internal use only
Instance Method Summary
Constructor Details
.new ⇒ Interlock
This method is for internal use only.
# 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 37
def done_running @lock.stop_sharing end
#done_unloading
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 29
def done_unloading @lock.stop_exclusive(compatible: [:unload]) end
#loading(&block)
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 12
def loading(&block) ActiveSupport.deprecator.warn( "ActiveSupport::Dependencies::Interlock#loading is deprecated and " \ "will be removed in Rails 9.0. The loading interlock is no longer " \ "used since Rails switched to Zeitwerk for autoloading." ) yield if block end
#permit_concurrent_loads(&block)
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 45
def permit_concurrent_loads(&block) # Soft deprecated: no deprecation warning for now, but this is a no-op. yield if block end
#raw_state(&block)
This method is for internal use only.
[ GitHub ]
# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 50
def raw_state(&block) # :nodoc: @lock.raw_state(&block) end
#running(&block)
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 41
def running(&block) @lock.sharing(&block) end
#start_running
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 33
def start_running @lock.start_sharing end
#start_unloading
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 25
def start_unloading @lock.start_exclusive(purpose: :unload, compatible: [:unload]) end
#unloading(&block)
[ GitHub ]# File 'activesupport/lib/active_support/dependencies/interlock.rb', line 21
def unloading(&block) @lock.exclusive(purpose: :unload, compatible: [:unload], after_compatible: [:unload], &block) end