brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2023-02-24 19:00:52 +00:00
parent ddb4229df3
commit e7980e9fb5
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
120 changed files with 48 additions and 44 deletions

View File

@ -23,7 +23,7 @@ kernel = (class << ::Kernel; self; end)
k.send(:private, :require) if private_require k.send(:private, :require) if private_require
end end
end end
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.2.0/lib/concurrent-ruby") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.2.1/lib/concurrent-ruby")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.17.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.17.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.6/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.6/lib")

View File

@ -1,3 +1,4 @@
require 'fiber'
require 'concurrent/utility/engine' require 'concurrent/utility/engine'
require 'concurrent/constants' require 'concurrent/constants'

View File

@ -9,8 +9,8 @@ module Concurrent
# @!visibility private # @!visibility private
class MriMapBackend < NonConcurrentMapBackend class MriMapBackend < NonConcurrentMapBackend
def initialize(options = nil) def initialize(options = nil, &default_proc)
super(options) super(options, &default_proc)
@write_lock = Mutex.new @write_lock = Mutex.new
end end

View File

@ -12,8 +12,10 @@ module Concurrent
# directly without calling each other. This is important because of the # directly without calling each other. This is important because of the
# SynchronizedMapBackend which uses a non-reentrant mutex for performance # SynchronizedMapBackend which uses a non-reentrant mutex for performance
# reasons. # reasons.
def initialize(options = nil) def initialize(options = nil, &default_proc)
@backend = {} validate_options_hash!(options) if options.kind_of?(::Hash)
@backend = Hash.new(&default_proc)
@default_proc = default_proc
end end
def [](key) def [](key)
@ -55,7 +57,7 @@ module Concurrent
end end
def compute(key) def compute(key)
store_computed_value(key, yield(@backend[key])) store_computed_value(key, yield(get_or_default(key, nil)))
end end
def merge_pair(key, value) def merge_pair(key, value)
@ -67,7 +69,7 @@ module Concurrent
end end
def get_and_set(key, value) def get_and_set(key, value)
stored_value = @backend[key] stored_value = get_or_default(key, nil)
@backend[key] = value @backend[key] = value
stored_value stored_value
end end
@ -109,13 +111,11 @@ module Concurrent
@backend.fetch(key, default_value) @backend.fetch(key, default_value)
end end
alias_method :_get, :[]
alias_method :_set, :[]=
private :_get, :_set
private private
def initialize_copy(other) def initialize_copy(other)
super super
@backend = {} @backend = Hash.new(&@default_proc)
self self
end end

View File

@ -46,6 +46,12 @@ module Concurrent
# @note Atomic methods taking a block do not allow the `self` instance # @note Atomic methods taking a block do not allow the `self` instance
# to be used within the block. Doing so will cause a deadlock. # to be used within the block. Doing so will cause a deadlock.
# @!method []=(key, value)
# Set a value with key
# @param [Object] key
# @param [Object] value
# @return [Object] the new value
# @!method compute_if_absent(key) # @!method compute_if_absent(key)
# Compute and store new value for key if the key is absent. # Compute and store new value for key if the key is absent.
# @param [Object] key # @param [Object] key
@ -119,43 +125,40 @@ module Concurrent
# @return [true, false] true if deleted # @return [true, false] true if deleted
# @!macro map.atomic_method # @!macro map.atomic_method
# # NonConcurrentMapBackend handles default_proc natively
def initialize(options = nil, &block) unless defined?(Collection::NonConcurrentMapBackend) and self < Collection::NonConcurrentMapBackend
if options.kind_of?(::Hash)
validate_options_hash!(options) # @param [Hash, nil] options options to set the :initial_capacity or :load_factor. Ignored on some Rubies.
else # @param [Proc] default_proc Optional block to compute the default value if the key is not set, like `Hash#default_proc`
options = nil def initialize(options = nil, &default_proc)
if options.kind_of?(::Hash)
validate_options_hash!(options)
else
options = nil
end
super(options)
@default_proc = default_proc
end end
super(options) # Get a value with key
@default_proc = block # @param [Object] key
end # @return [Object] the value
def [](key)
# Get a value with key if value = super # non-falsy value is an existing mapping, return it right away
# @param [Object] key value
# @return [Object] the value # re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
def [](key) # a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
if value = super # non-falsy value is an existing mapping, return it right away # would be returned)
value # note: nil == value check is not technically necessary
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value @default_proc.call(self, key)
# would be returned) else
# note: nil == value check is not technically necessary value
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL)) end
@default_proc.call(self, key)
else
value
end end
end end
# Set a value with key
# @param [Object] key
# @param [Object] value
# @return [Object] the new value
def []=(key, value)
super
end
alias_method :get, :[] alias_method :get, :[]
alias_method :put, :[]= alias_method :put, :[]=

Some files were not shown because too many files have changed in this diff Show More