aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies/interlock.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-03-02 02:56:53 +1030
committerMatthew Draper <matthew@trebex.net>2016-03-02 02:56:53 +1030
commit541e4abb4b3710a384aefac83cafd0ab878c60bf (patch)
tree55603da9b6f9407a24c68e1d1fd53e109c4131e7 /activesupport/lib/active_support/dependencies/interlock.rb
parentecdc0fbc872ea734adf29b3f9f3463b916235286 (diff)
parent60b53e9883bfd9f4edb640dbe2de89227b875e09 (diff)
downloadrails-541e4abb4b3710a384aefac83cafd0ab878c60bf.tar.gz
rails-541e4abb4b3710a384aefac83cafd0ab878c60bf.tar.bz2
rails-541e4abb4b3710a384aefac83cafd0ab878c60bf.zip
Merge pull request #23807 from matthewd/executor
Publish AS::Executor and AS::Reloader APIs
Diffstat (limited to 'activesupport/lib/active_support/dependencies/interlock.rb')
-rw-r--r--activesupport/lib/active_support/dependencies/interlock.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/dependencies/interlock.rb b/activesupport/lib/active_support/dependencies/interlock.rb
index 47bcecbb35..f1865ca2f8 100644
--- a/activesupport/lib/active_support/dependencies/interlock.rb
+++ b/activesupport/lib/active_support/dependencies/interlock.rb
@@ -19,14 +19,12 @@ module ActiveSupport #:nodoc:
end
end
- # Attempt to obtain an "unloading" (exclusive) lock. If possible,
- # execute the supplied block while holding the lock. If there is
- # concurrent activity, return immediately (without executing the
- # block) instead of waiting.
- def attempt_unloading
- @lock.exclusive(purpose: :unload, compatible: [:load, :unload], after_compatible: [:load, :unload], no_wait: true) do
- yield
- end
+ def start_unloading
+ @lock.start_exclusive(purpose: :unload, compatible: [:load, :unload])
+ end
+
+ def done_unloading
+ @lock.stop_exclusive(compatible: [:load, :unload])
end
def start_running