class ActiveSupport::Concurrency::ShareLock

def exclusive(purpose: nil, compatible: [], after_compatible: [], no_wait: false)

See +start_exclusive+ for other options.

the block.
returns +nil+ without yielding. Otherwise, returns the result of
+no_wait+ is set and the lock is not immediately available,
Execute the supplied block while holding the Exclusive lock. If
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