module Sequel::Plugins::WithLock::InstanceMethods
Public Instance Methods
with_lock(savepoint: true) { || ... }
click to toggle source
Execute block with lock
@yield
# File lib/sequel/plugins/with_lock.rb, line 8 def with_lock(savepoint: true) return yield if @__locked @__locked = true begin db.transaction(savepoint: savepoint) do lock! yield end ensure @__locked = false end end