Class: ActiveSupport::Dependencies::Interlock
- Defined in:
- lib/active_support/dependencies/interlock.rb
Instance Method Summary collapse
- #done_running ⇒ Object
- #done_unloading ⇒ Object
-
#initialize ⇒ Interlock
constructor
:nodoc:.
- #loading(&block) ⇒ Object
- #permit_concurrent_loads(&block) ⇒ Object
-
#raw_state(&block) ⇒ Object
:nodoc:.
- #running(&block) ⇒ Object
- #start_running ⇒ Object
- #start_unloading ⇒ Object
- #unloading(&block) ⇒ Object
Constructor Details
permalink #initialize ⇒ Interlock
:nodoc:
8 9 10 |
# File 'lib/active_support/dependencies/interlock.rb', line 8 def initialize # :nodoc: @lock = ActiveSupport::Concurrency::ShareLock.new end |
Instance Method Details
permalink #done_running ⇒ Object
[View source]
32 33 34 |
# File 'lib/active_support/dependencies/interlock.rb', line 32 def done_running @lock.stop_sharing end |
permalink #done_unloading ⇒ Object
[View source]
24 25 26 |
# File 'lib/active_support/dependencies/interlock.rb', line 24 def done_unloading @lock.stop_exclusive(compatible: [:load, :unload]) end |
permalink #loading(&block) ⇒ Object
[View source]
12 13 14 |
# File 'lib/active_support/dependencies/interlock.rb', line 12 def loading(&block) @lock.exclusive(purpose: :load, compatible: [:load], after_compatible: [:load], &block) end |
permalink #permit_concurrent_loads(&block) ⇒ Object
[View source]
40 41 42 |
# File 'lib/active_support/dependencies/interlock.rb', line 40 def permit_concurrent_loads(&block) @lock.yield_shares(compatible: [:load], &block) end |
permalink #raw_state(&block) ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/active_support/dependencies/interlock.rb', line 44 def raw_state(&block) # :nodoc: @lock.raw_state(&block) end |
permalink #running(&block) ⇒ Object
[View source]
36 37 38 |
# File 'lib/active_support/dependencies/interlock.rb', line 36 def running(&block) @lock.sharing(&block) end |
permalink #start_running ⇒ Object
[View source]
28 29 30 |
# File 'lib/active_support/dependencies/interlock.rb', line 28 def start_running @lock.start_sharing end |
permalink #start_unloading ⇒ Object
[View source]
20 21 22 |
# File 'lib/active_support/dependencies/interlock.rb', line 20 def start_unloading @lock.start_exclusive(purpose: :unload, compatible: [:load, :unload]) end |
permalink #unloading(&block) ⇒ Object
[View source]
16 17 18 |
# File 'lib/active_support/dependencies/interlock.rb', line 16 def unloading(&block) @lock.exclusive(purpose: :unload, compatible: [:load, :unload], after_compatible: [:load, :unload], &block) end |