aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/concurrency/share_lock.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/concurrency/share_lock.rb')
-rw-r--r--activesupport/lib/active_support/concurrency/share_lock.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/activesupport/lib/active_support/concurrency/share_lock.rb b/activesupport/lib/active_support/concurrency/share_lock.rb
index f57e81bad8..e61dadd0cc 100644
--- a/activesupport/lib/active_support/concurrency/share_lock.rb
+++ b/activesupport/lib/active_support/concurrency/share_lock.rb
@@ -201,26 +201,26 @@ module ActiveSupport
private
# Must be called within synchronize
- def busy_for_exclusive?(purpose)
- busy_for_sharing?(purpose) ||
- @sharing.size > (@sharing[Thread.current] > 0 ? 1 : 0)
- end
+ def busy_for_exclusive?(purpose)
+ busy_for_sharing?(purpose) ||
+ @sharing.size > (@sharing[Thread.current] > 0 ? 1 : 0)
+ end
- def busy_for_sharing?(purpose)
- (@exclusive_thread && @exclusive_thread != Thread.current) ||
- @waiting.any? { |t, (_, c)| t != Thread.current && !c.include?(purpose) }
- end
+ def busy_for_sharing?(purpose)
+ (@exclusive_thread && @exclusive_thread != Thread.current) ||
+ @waiting.any? { |t, (_, c)| t != Thread.current && !c.include?(purpose) }
+ end
- def eligible_waiters?(compatible)
- @waiting.any? { |t, (p, _)| compatible.include?(p) && @waiting.all? { |t2, (_, c2)| t == t2 || c2.include?(p) } }
- end
+ def eligible_waiters?(compatible)
+ @waiting.any? { |t, (p, _)| compatible.include?(p) && @waiting.all? { |t2, (_, c2)| t == t2 || c2.include?(p) } }
+ end
- def wait_for(method)
- @sleeping[Thread.current] = method
- @cv.wait_while { yield }
- ensure
- @sleeping.delete Thread.current
- end
+ def wait_for(method)
+ @sleeping[Thread.current] = method
+ @cv.wait_while { yield }
+ ensure
+ @sleeping.delete Thread.current
+ end
end
end
end