instance method
start_sharing
Ruby on Rails edge
Since v5.0.7.2Signature
start_sharing()
No documentation comment.
Source
# File activesupport/lib/active_support/concurrency/share_lock.rb, line 116
def start_sharing
synchronize do
owner = current_owner
if @sharing[owner] > 0 || @exclusive_owner == owner
# We already hold a lock; nothing to wait for
elsif @waiting[owner]
# We're nested inside a `yield_shares` call: we'll resume as
# soon as there isn't an exclusive lock in our way
wait_for(:start_sharing) { @exclusive_owner }
else
# This is an initial / outermost share call: any outstanding
# requests for an exclusive lock get to go first
wait_for(:start_sharing) { busy_for_sharing?(false) }
end
@sharing[owner] += 1
end
end
Defined in activesupport/lib/active_support/concurrency/share_lock.rb line 116
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Concurrency::ShareLock