instance method
exclusive
Ruby on Rails 6.0.6
Since v5.2.8.1Signature
exclusive(purpose: nil, compatible: [], after_compatible: [], no_wait: false)
Execute the supplied block while holding the Exclusive lock. If no_wait is set and the lock is not immediately available, returns nil without yielding. Otherwise, returns the result of the block.
See start_exclusive for other options.
Parameters
-
purposekey = nil -
compatiblekey = [] -
after_compatiblekey = [] -
no_waitkey = false
Source
# File activesupport/lib/active_support/concurrency/share_lock.rb, line 148
def exclusive(purpose: nil, compatible: [], after_compatible: [], no_wait: false)
if start_exclusive(purpose: purpose, compatible: compatible, no_wait: no_wait)
begin
yield
ensure
stop_exclusive(compatible: after_compatible)
end
end
end
Defined in activesupport/lib/active_support/concurrency/share_lock.rb line 148
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Concurrency::ShareLock