提交 b3d78e8c 编写于 作者: T thedarkone

Fix ShareLock issues.

上级 9c4da24a
......@@ -52,7 +52,7 @@ def start_exclusive(purpose: nil, compatible: [], no_wait: false)
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 @@ def sharing
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册