brew vendor-gems: commit updates.
This commit is contained in:
parent
42f1f7d4ad
commit
6bf72e5fca
@ -3,7 +3,7 @@ require 'rbconfig'
|
||||
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
|
||||
ruby_version = RbConfig::CONFIG["ruby_version"]
|
||||
path = File.expand_path('..', __FILE__)
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.10/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.4/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
module Concurrent
|
||||
VERSION = '1.1.8'
|
||||
end
|
||||
@ -0,0 +1,14 @@
|
||||
module Concurrent
|
||||
|
||||
# @!visibility private
|
||||
module Collection
|
||||
|
||||
# @!visibility private
|
||||
class TruffleRubyMapBackend < TruffleRuby::ConcurrentMap
|
||||
def initialize(options = nil)
|
||||
options ||= {}
|
||||
super(initial_capacity: options[:initial_capacity], load_factor: options[:load_factor])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -30,7 +30,7 @@ module Concurrent
|
||||
if @queue[k] == item
|
||||
swap(k, @length)
|
||||
@length -= 1
|
||||
sink(k)
|
||||
sink(k) || swim(k)
|
||||
@queue.pop
|
||||
else
|
||||
k += 1
|
||||
@ -126,12 +126,17 @@ module Concurrent
|
||||
#
|
||||
# @!visibility private
|
||||
def sink(k)
|
||||
success = false
|
||||
|
||||
while (j = (2 * k)) <= @length do
|
||||
j += 1 if j < @length && ! ordered?(j, j+1)
|
||||
break if ordered?(k, j)
|
||||
swap(k, j)
|
||||
success = true
|
||||
k = j
|
||||
end
|
||||
|
||||
success
|
||||
end
|
||||
|
||||
# Percolate up to maintain heap invariant.
|
||||
@ -140,10 +145,15 @@ module Concurrent
|
||||
#
|
||||
# @!visibility private
|
||||
def swim(k)
|
||||
success = false
|
||||
|
||||
while k > 1 && ! ordered?(k/2, k) do
|
||||
swap(k, k/2)
|
||||
k = k/2
|
||||
end
|
||||
success = true
|
||||
end
|
||||
|
||||
success
|
||||
end
|
||||
end
|
||||
end
|
||||
Binary file not shown.
@ -15,7 +15,10 @@ module Concurrent
|
||||
when Concurrent.on_cruby?
|
||||
require 'concurrent/collection/map/mri_map_backend'
|
||||
MriMapBackend
|
||||
when Concurrent.on_rbx? || Concurrent.on_truffleruby?
|
||||
when Concurrent.on_truffleruby? && defined?(::TruffleRuby::ConcurrentMap)
|
||||
require 'concurrent/collection/map/truffleruby_map_backend'
|
||||
TruffleRubyMapBackend
|
||||
when Concurrent.on_truffleruby? || Concurrent.on_rbx?
|
||||
require 'concurrent/collection/map/atomic_reference_map_backend'
|
||||
AtomicReferenceMapBackend
|
||||
else
|
||||
@ -114,7 +117,7 @@ module Concurrent
|
||||
# @return [true, false] true if deleted
|
||||
# @!macro map.atomic_method
|
||||
|
||||
|
||||
#
|
||||
def initialize(options = nil, &block)
|
||||
if options.kind_of?(::Hash)
|
||||
validate_options_hash!(options)
|
||||
@ -143,8 +146,15 @@ module Concurrent
|
||||
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, :[]
|
||||
# TODO (pitr-ch 30-Oct-2018): doc
|
||||
alias_method :put, :[]=
|
||||
|
||||
# Get a value with key, or default_value when key is absent,
|
||||
@ -250,6 +250,7 @@ module Concurrent
|
||||
realize(@promise_body)
|
||||
end
|
||||
else
|
||||
compare_and_set_state(:pending, :unscheduled)
|
||||
@parent.execute
|
||||
end
|
||||
self
|
||||
@ -19,13 +19,19 @@ module Concurrent
|
||||
#
|
||||
# @see http://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html Ruby standard library `Set`
|
||||
|
||||
|
||||
# @!macro internal_implementation_note
|
||||
SetImplementation = case
|
||||
when Concurrent.on_cruby?
|
||||
# Because MRI never runs code in parallel, the existing
|
||||
# non-thread-safe structures should usually work fine.
|
||||
::Set
|
||||
# The CRuby implementation of Set is written in Ruby itself and is
|
||||
# not thread safe for certain methods.
|
||||
require 'monitor'
|
||||
require 'concurrent/thread_safe/util/data_structures'
|
||||
|
||||
class CRubySet < ::Set
|
||||
end
|
||||
|
||||
ThreadSafe::Util.make_synchronized_on_cruby CRubySet
|
||||
CRubySet
|
||||
|
||||
when Concurrent.on_jruby?
|
||||
require 'jruby/synchronized'
|
||||
@ -33,6 +39,7 @@ module Concurrent
|
||||
class JRubySet < ::Set
|
||||
include JRuby::Synchronized
|
||||
end
|
||||
|
||||
JRubySet
|
||||
|
||||
when Concurrent.on_rbx?
|
||||
@ -41,7 +48,8 @@ module Concurrent
|
||||
|
||||
class RbxSet < ::Set
|
||||
end
|
||||
ThreadSafe::Util.make_synchronized_on_rbx Concurrent::RbxSet
|
||||
|
||||
ThreadSafe::Util.make_synchronized_on_rbx RbxSet
|
||||
RbxSet
|
||||
|
||||
when Concurrent.on_truffleruby?
|
||||
@ -50,7 +58,7 @@ module Concurrent
|
||||
class TruffleRubySet < ::Set
|
||||
end
|
||||
|
||||
ThreadSafe::Util.make_synchronized_on_truffleruby Concurrent::TruffleRubySet
|
||||
ThreadSafe::Util.make_synchronized_on_truffleruby TruffleRubySet
|
||||
TruffleRubySet
|
||||
|
||||
else
|
||||
@ -32,6 +32,12 @@ module Concurrent
|
||||
@__Condition__ = ::ConditionVariable.new
|
||||
end
|
||||
|
||||
def initialize_copy(other)
|
||||
super
|
||||
@__Lock__ = ::Mutex.new
|
||||
@__Condition__ = ::ConditionVariable.new
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def synchronize
|
||||
@ -61,6 +67,12 @@ module Concurrent
|
||||
@__Condition__ = @__Lock__.new_cond
|
||||
end
|
||||
|
||||
def initialize_copy(other)
|
||||
super
|
||||
@__Lock__ = ::Monitor.new
|
||||
@__Condition__ = @__Lock__.new_cond
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def synchronize # TODO may be a problem with lock.synchronize { lock.wait }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user