aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/concurrency
diff options
context:
space:
mode:
authorthedarkone <thedarkone2@gmail.com>2015-07-20 18:59:18 +0200
committerthedarkone <thedarkone2@gmail.com>2015-07-20 19:01:15 +0200
commitb3d78e8c23e3cbd5325719474efb9f7ee4168f72 (patch)
treef58a0cbf8ce066bdb1a51d3d0ecdb522b0b82033 /activesupport/lib/active_support/concurrency
parent9c4da24aca20633fa109c92cbeee71ebd5ea2e87 (diff)
downloadrails-b3d78e8c23e3cbd5325719474efb9f7ee4168f72.tar.gz
rails-b3d78e8c23e3cbd5325719474efb9f7ee4168f72.tar.bz2
rails-b3d78e8c23e3cbd5325719474efb9f7ee4168f72.zip
Fix ShareLock issues.
Diffstat (limited to 'activesupport/lib/active_support/concurrency')
-rw-r--r--activesupport/lib/active_support/concurrency/share_lock.rb4
1 files changed, 2 insertions, 2 deletions
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