diff options
author | Matthew Draper <matthew@trebex.net> | 2016-02-07 08:24:57 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-02-07 08:32:27 +1030 |
commit | 3e4a69e52d8c8f0335e0ddbb46fe21009b962334 (patch) | |
tree | 172481e3ea5e3ed7496ff2541a595343fbd49ae8 /activesupport/lib/active_support/dependencies | |
parent | 8526e9bed21a119266e886c3316d3fe10c9af5ce (diff) | |
download | rails-3e4a69e52d8c8f0335e0ddbb46fe21009b962334.tar.gz rails-3e4a69e52d8c8f0335e0ddbb46fe21009b962334.tar.bz2 rails-3e4a69e52d8c8f0335e0ddbb46fe21009b962334.zip |
Hand off the interlock to the new thread in AC::Live
Most importantly, the original request thread must yield its share lock
while waiting for the live thread to commit -- otherwise a request's
base and live threads can deadlock against each other.
Diffstat (limited to 'activesupport/lib/active_support/dependencies')
-rw-r--r-- | activesupport/lib/active_support/dependencies/interlock.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/dependencies/interlock.rb b/activesupport/lib/active_support/dependencies/interlock.rb index b6a1b25eee..47bcecbb35 100644 --- a/activesupport/lib/active_support/dependencies/interlock.rb +++ b/activesupport/lib/active_support/dependencies/interlock.rb @@ -42,6 +42,12 @@ module ActiveSupport #:nodoc: yield end end + + def permit_concurrent_loads + @lock.yield_shares(compatible: [:load]) do + yield + end + end end end end |