diff options
author | Matthew Draper <matthew@trebex.net> | 2016-03-02 02:56:53 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-03-02 02:56:53 +1030 |
commit | 541e4abb4b3710a384aefac83cafd0ab878c60bf (patch) | |
tree | 55603da9b6f9407a24c68e1d1fd53e109c4131e7 /activesupport/lib/active_support/dependencies/interlock.rb | |
parent | ecdc0fbc872ea734adf29b3f9f3463b916235286 (diff) | |
parent | 60b53e9883bfd9f4edb640dbe2de89227b875e09 (diff) | |
download | rails-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.rb | 14 |
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 |