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:
parent
9c4da24aca
commit
b3d78e8c23
1 changed files with 2 additions and 2 deletions
|
@ -52,7 +52,7 @@ module ActiveSupport
|
||||||
return false if no_wait
|
return false if no_wait
|
||||||
|
|
||||||
loose_shares = @sharing.delete(Thread.current)
|
loose_shares = @sharing.delete(Thread.current)
|
||||||
@waiting[Thread.current] = compatible if loose_shares
|
@waiting[Thread.current] = compatible
|
||||||
|
|
||||||
@cv.wait_while { busy?(purpose) }
|
@cv.wait_while { busy?(purpose) }
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ module ActiveSupport
|
||||||
# Must be called within synchronize
|
# Must be called within synchronize
|
||||||
def busy?(purpose)
|
def busy?(purpose)
|
||||||
(@exclusive_thread && @exclusive_thread != Thread.current) ||
|
(@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)
|
@sharing.size > (@sharing[Thread.current] > 0 ? 1 : 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue