Class: ActiveSupport::Dependencies::Interlock

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb

Instance Method Summary collapse

Constructor Details

#initializeInterlock

:nodoc:



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 8

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

Instance Method Details

#done_runningObject



32
33
34
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 32

def done_running
  @lock.stop_sharing
end

#done_unloadingObject



24
25
26
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 24

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

#loading(&block) ⇒ Object



12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/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) ⇒ Object



40
41
42
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 40

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

#raw_state(&block) ⇒ Object

:nodoc:



44
45
46
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 44

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

#running(&block) ⇒ Object



36
37
38
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 36

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

#start_runningObject



28
29
30
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 28

def start_running
  @lock.start_sharing
end

#start_unloadingObject



20
21
22
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 20

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

#unloading(&block) ⇒ Object



16
17
18
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/dependencies/interlock.rb', line 16

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