/usr/lib/ruby/vendor_ruby/moneta/lock.rb is in ruby-moneta 0.7.20-2.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require 'thread'
module Moneta
# Locks the underlying stores with a Mutex
# @api public
class Lock < Wrapper
# @param [Moneta store] adapter The underlying store
# @param [Hash] options
# @option options [String] :mutex (::Mutex.new) Mutex object
def initialize(adapter, options = {})
super
@lock = options[:mutex] || ::Mutex.new
end
protected
def wrap(*args, &block)
@lock.synchronize(&block)
end
end
end
|