From 65b6496ee4cf62be4c43ff21572e03a5e9cedac1 Mon Sep 17 00:00:00 2001 From: Jeremy Daer Date: Sun, 24 Apr 2016 09:56:34 -0700 Subject: 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. --- activesupport/lib/active_support/concurrency/share_lock.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activesupport/lib/active_support/concurrency') 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 -- cgit v1.2.3