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