class Hamster::ReadCopyUpdateHash
def delete(key)
def delete(key) @lock.synchronize { original_value = @hash.get(key) @hash = @hash.delete(key) original_value } end
def eql?(other)
def eql?(other) instance_of?(other.class) && @hash.eql?(other.instance_variable_get(:@hash)) end
def initialize
def initialize @hash = EmptyHash @lock = Mutex.new end
def method_missing(name, *args, &block)
def method_missing(name, *args, &block) @hash.send(name, *args, &block) end
def put(key, value)
def put(key, value) @lock.synchronize { original_value = @hash.get(key) @hash = @hash.put(key, value) original_value } end