1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix ShareLock issues.

This commit is contained in:
thedarkone 2015-07-20 18:59:18 +02:00
parent 9c4da24aca
commit b3d78e8c23

View file

@ -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