From b3d78e8c23e3cbd5325719474efb9f7ee4168f72 Mon Sep 17 00:00:00 2001 From: thedarkone Date: Mon, 20 Jul 2015 18:59:18 +0200 Subject: Fix ShareLock issues. --- activesupport/lib/active_support/concurrency/share_lock.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/concurrency/share_lock.rb b/activesupport/lib/active_support/concurrency/share_lock.rb index 39ae9bfb79..35193ea9f7 100644 --- a/activesupport/lib/active_support/concurrency/share_lock.rb +++ b/activesupport/lib/active_support/concurrency/share_lock.rb @@ -52,7 +52,7 @@ module ActiveSupport return false if no_wait loose_shares = @sharing.delete(Thread.current) - @waiting[Thread.current] = compatible if loose_shares + @waiting[Thread.current] = compatible @cv.wait_while { busy?(purpose) } @@ -132,7 +132,7 @@ module ActiveSupport # Must be called within synchronize def busy?(purpose) (@exclusive_thread && @exclusive_thread != Thread.current) || - @waiting.any? { |k, v| k != Thread.current && !v.include?(purpose) } || + (purpose && @waiting.any? { |k, v| k != Thread.current && !v.include?(purpose) }) || @sharing.size > (@sharing[Thread.current] > 0 ? 1 : 0) end end -- cgit v1.2.3