Skip to content

Commit

Permalink
Require Ruby 2.3+ and drop Ruby 2.2 support
Browse files Browse the repository at this point in the history
* Set `required_ruby_version` to 2.3.
* `rb_data_object_alloc()` is deprecated since a long time
  by `rb_data_object_wrap()` but that is not available in Ruby 2.2,
  so drop Ruby 2.2 support.
  • Loading branch information
eregon committed Dec 21, 2022
1 parent 33f777f commit 506302a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby, truffleruby]
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby, truffleruby]

env:
JAVA_OPTS: '-Xmx1024m'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Current

* (#975) Set the Ruby compatibility version at 2.3
* (#972) Remove Rubinius-related code

## Release v1.1.10

concurrent-ruby:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m

## Supported Ruby versions

* MRI 2.2 and above
* MRI 2.3 and above
* Latest JRuby 9000
* Latest TruffleRuby

Expand Down
2 changes: 1 addition & 1 deletion concurrent-ruby-edge.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
Please see http://concurrent-ruby.com for more information.
TXT

s.required_ruby_version = '>= 2.2'
s.required_ruby_version = '>= 2.3'

s.add_runtime_dependency 'concurrent-ruby', "~> #{Concurrent::VERSION}"
end
2 changes: 1 addition & 1 deletion concurrent-ruby-ext.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']
s.extensions = 'ext/concurrent-ruby-ext/extconf.rb'

s.required_ruby_version = '>= 2.2'
s.required_ruby_version = '>= 2.3'

s.add_runtime_dependency 'concurrent-ruby', "= #{Concurrent::VERSION}"
end
2 changes: 1 addition & 1 deletion concurrent-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ Gem::Specification.new do |s|
TXT
s.metadata["source_code_uri"] = "https://github.com/ruby-concurrency/concurrent-ruby"
s.metadata["changelog_uri"] = "https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md"
s.required_ruby_version = '>= 2.2'
s.required_ruby_version = '>= 2.3'
end
4 changes: 0 additions & 4 deletions lib/concurrent-ruby/concurrent/utility/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ def on_jruby?
RUBY_ENGINE == 'jruby'
end

def on_jruby_9000?
on_jruby? && ruby_version(JRUBY_VERSION, :>=, 9, 0, 0)
end

def on_cruby?
RUBY_ENGINE == 'ruby'
end
Expand Down
48 changes: 23 additions & 25 deletions spec/concurrent/executor/ruby_thread_pool_executor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,36 +157,34 @@ def eventually(mutex: nil, timeout: 5, &block)
end
end

if Concurrent.on_cruby? && Concurrent.ruby_version(:>=, 2, 3, 0)
context 'threads naming' do
subject do
opts = { min_threads: 2 }
opts[:name] = pool_name if pool_name
described_class.new(opts)
end
context 'threads naming' do
subject do
opts = { min_threads: 2 }
opts[:name] = pool_name if pool_name
described_class.new(opts)
end

let(:names) { Concurrent::Set.new }
let(:names) { Concurrent::Set.new }

before do
subject.post(names) { |names| names << Thread.current.name }
subject.post(names) { |names| names << Thread.current.name }
subject.shutdown
subject.wait_for_termination(pool_termination_timeout)
expect(names.size).to eq 2
end
before do
subject.post(names) { |names| names << Thread.current.name }
subject.post(names) { |names| names << Thread.current.name }
subject.shutdown
subject.wait_for_termination(pool_termination_timeout)
expect(names.size).to eq 2
end

context 'without pool name' do
let(:pool_name) { }
it 'sets counted name' do
expect(names.all? { |name| name =~ /^worker-\d+$/ }).to be true
end
context 'without pool name' do
let(:pool_name) { }
it 'sets counted name' do
expect(names.all? { |name| name =~ /^worker-\d+$/ }).to be true
end
end

context 'with pool name' do
let(:pool_name) { 'MyExecutor' }
it 'sets counted name' do
expect(names.all? { |name| name =~ /^MyExecutor-worker-\d+$/ }).to be true
end
context 'with pool name' do
let(:pool_name) { 'MyExecutor' }
it 'sets counted name' do
expect(names.all? { |name| name =~ /^MyExecutor-worker-\d+$/ }).to be true
end
end
end
Expand Down

0 comments on commit 506302a

Please sign in to comment.