diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-24 09:56:34 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-24 10:14:53 -0700 |
commit | 65b6496ee4cf62be4c43ff21572e03a5e9cedac1 (patch) | |
tree | a1e5a8cda24c74679ff6397f95ca53e92c266176 /activesupport/lib/active_support/concurrency | |
parent | 24b1bb1a0fce26dca95126ae5756acf02e25aff8 (diff) | |
download | rails-65b6496ee4cf62be4c43ff21572e03a5e9cedac1.tar.gz rails-65b6496ee4cf62be4c43ff21572e03a5e9cedac1.tar.bz2 rails-65b6496ee4cf62be4c43ff21572e03a5e9cedac1.zip |
Share lock: more accurate livelock fix for aa598f4
Awaken waiting threads even if the current thread (the previously
exclusive thread) hadn't taken a share lock.
This only happens in code that wasn't run within an executor, since that
always take an outermost share lock.
Diffstat (limited to 'activesupport/lib/active_support/concurrency')
-rw-r--r-- | activesupport/lib/active_support/concurrency/share_lock.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/concurrency/share_lock.rb b/activesupport/lib/active_support/concurrency/share_lock.rb index e4af984cf6..89e63aefd4 100644 --- a/activesupport/lib/active_support/concurrency/share_lock.rb +++ b/activesupport/lib/active_support/concurrency/share_lock.rb @@ -69,7 +69,6 @@ module ActiveSupport if eligible_waiters?(compatible) yield_shares(compatible: compatible, block_share: true) do - @cv.broadcast @cv.wait_while { @exclusive_thread || eligible_waiters?(compatible) } end end @@ -145,9 +144,9 @@ module ActiveSupport end compatible |= [false] unless block_share @waiting[Thread.current] = [purpose, compatible] - - @cv.broadcast end + + @cv.broadcast end begin |