From dbfbc14097c16df30485bb295afe60c9b0282887 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 15 Jan 2025 22:39:01 +0100 Subject: [PATCH 01/10] Document Bundler workaround for releasing --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63ee743c5..1ba61857c 100644 --- a/README.md +++ b/README.md @@ -358,7 +358,8 @@ best practice is to depend on `concurrent-ruby` and let users to decide if they * Recent CRuby * JRuby, `rbenv install jruby-9.2.17.0` * Set env variable `CONCURRENT_JRUBY_HOME` to point to it, e.g. `/usr/local/opt/rbenv/versions/jruby-9.2.17.0` -* Install Docker, required for Windows builds +* Install Docker or Podman, required for Windows builds +* If `bundle config get path` is set, use `bundle config set --local path.system true` otherwise the `gem name, path: '.'` gems won't be found (Bundler limitation). ### Publishing the Gem From 855a6dc19990bffab3406807928bb8a35ca1f7fe Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 27 Jan 2025 21:16:07 +0100 Subject: [PATCH 02/10] Fix guards in specs using C extension classes * Fixes https://github.com/ruby-concurrency/concurrent-ruby/issues/1080 --- spec/concurrent/atomic/atomic_boolean_spec.rb | 4 ++-- spec/concurrent/atomic/atomic_fixnum_spec.rb | 4 ++-- spec/concurrent/atomic/atomic_reference_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/concurrent/atomic/atomic_boolean_spec.rb b/spec/concurrent/atomic/atomic_boolean_spec.rb index 133b7f2ce..76edd3e27 100644 --- a/spec/concurrent/atomic/atomic_boolean_spec.rb +++ b/spec/concurrent/atomic/atomic_boolean_spec.rb @@ -142,7 +142,7 @@ module Concurrent end end - if Concurrent.allow_c_extensions? + if Concurrent.c_extensions_loaded? RSpec.describe CAtomicBoolean do it_should_behave_like :atomic_boolean end @@ -165,7 +165,7 @@ module Concurrent it 'inherits from JavaAtomicBoolean' do expect(AtomicBoolean.ancestors).to include(JavaAtomicBoolean) end - elsif Concurrent.allow_c_extensions? + elsif Concurrent.c_extensions_loaded? it 'inherits from CAtomicBoolean' do expect(AtomicBoolean.ancestors).to include(CAtomicBoolean) end diff --git a/spec/concurrent/atomic/atomic_fixnum_spec.rb b/spec/concurrent/atomic/atomic_fixnum_spec.rb index 39259b13f..8222bf523 100644 --- a/spec/concurrent/atomic/atomic_fixnum_spec.rb +++ b/spec/concurrent/atomic/atomic_fixnum_spec.rb @@ -204,7 +204,7 @@ module Concurrent end end - if Concurrent.allow_c_extensions? + if Concurrent.c_extensions_loaded? RSpec.describe CAtomicFixnum do it_should_behave_like :atomic_fixnum end @@ -227,7 +227,7 @@ module Concurrent it 'inherits from JavaAtomicFixnum' do expect(AtomicFixnum.ancestors).to include(JavaAtomicFixnum) end - elsif Concurrent.allow_c_extensions? + elsif Concurrent.c_extensions_loaded? it 'inherits from CAtomicFixnum' do expect(AtomicFixnum.ancestors).to include(CAtomicFixnum) end diff --git a/spec/concurrent/atomic/atomic_reference_spec.rb b/spec/concurrent/atomic/atomic_reference_spec.rb index 2cc0caada..7eaf2e55e 100644 --- a/spec/concurrent/atomic/atomic_reference_spec.rb +++ b/spec/concurrent/atomic/atomic_reference_spec.rb @@ -163,7 +163,7 @@ module Concurrent it_should_behave_like :atomic_reference end - if Concurrent.allow_c_extensions? + if Concurrent.c_extensions_loaded? RSpec.describe CAtomicReference do it_should_behave_like :atomic_reference end @@ -190,7 +190,7 @@ module Concurrent it 'inherits from JavaAtomicReference' do expect(described_class.ancestors).to include(Concurrent::JavaAtomicReference) end - elsif Concurrent.allow_c_extensions? + elsif Concurrent.c_extensions_loaded? it 'inherits from CAtomicReference' do expect(described_class.ancestors).to include(Concurrent::CAtomicReference) end From 870abda1d4cff41cf2a269ad4f3d44e4d9dd1421 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Tue, 28 Jan 2025 10:27:41 +0100 Subject: [PATCH 03/10] Run tests without the C extension in CI --- .github/workflows/ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab1d23db8..07b5e6583 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ concurrency: jobs: build: + name: "Tests: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}" runs-on: ${{ matrix.os }}-latest timeout-minutes: 10 @@ -23,7 +24,6 @@ jobs: RUBYOPT: '-w' JRUBY_OPTS: '--dev' - name: "Tests: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}" steps: - name: Clone Repo uses: actions/checkout@v4 @@ -35,6 +35,21 @@ jobs: - name: Run tests run: bundle exec rake ci + no-extensions: + name: "Test without C extension" + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + RUBYOPT: '-w' + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ruby + bundler-cache: true + - name: Run tests + run: bundle exec rake spec:ci + isolated: name: "Test isolated" runs-on: ubuntu-latest From 6e2bd8a25878de59e5faedfb9632d4c5d76d7e7c Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Tue, 28 Jan 2025 10:33:06 +0100 Subject: [PATCH 04/10] Add 3.4 in CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07b5e6583..093571fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, jruby, truffleruby] + ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, 3.4, jruby, truffleruby] os: [ubuntu] include: - - ruby: 3.3 + - ruby: ruby os: windows env: From 2aa6f645ee25e9692ab655903139bcf7d57dd545 Mon Sep 17 00:00:00 2001 From: Daniel Diekmeier Date: Tue, 18 Feb 2025 18:20:31 +0100 Subject: [PATCH 05/10] Fix typo --- lib/concurrent-ruby/concurrent/promise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/concurrent-ruby/concurrent/promise.rb b/lib/concurrent-ruby/concurrent/promise.rb index c717f9b0d..8df80b0c7 100644 --- a/lib/concurrent-ruby/concurrent/promise.rb +++ b/lib/concurrent-ruby/concurrent/promise.rb @@ -167,7 +167,7 @@ module Concurrent # c2 = p.then(-> reason { raise 'Boom!' }) # # c1.wait.state #=> :fulfilled - # c1.value #=> 45 + # c1.value #=> 42 # c2.wait.state #=> :rejected # c2.reason #=> # # ``` From c8f0bae98f1233dde681441b85dbc29a869267bd Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Sat, 22 Mar 2025 15:58:57 -0500 Subject: [PATCH 06/10] Correct word in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ba61857c..6635e815a 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ Deprecated features are still available and bugs are being fixed, but new featur These are available in the `concurrent-ruby-edge` companion gem. These features are under active development and may change frequently. They are expected not to -keep backward compatibility (there may also lack tests and documentation). Semantic versions will +keep backward compatibility (they may also lack tests and documentation). Semantic versions will be obeyed though. Features developed in `concurrent-ruby-edge` are expected to move to `concurrent-ruby` when final. From 52f0ee417e28210d8848dd532ed332744791538c Mon Sep 17 00:00:00 2001 From: Alexandr Bulancov <6594487+trinistr@users.noreply.github.com> Date: Fri, 4 Jul 2025 17:15:49 +0300 Subject: [PATCH 07/10] Fix mistakes in MVar documentation --- .github/CONTRIBUTING.md | 4 ++-- lib/concurrent-ruby/concurrent/mvar.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a865b48b3..0f6450e5c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -66,7 +66,7 @@ There are a few guidelines which we follow when adding features. Consider that s #### Write Documentation -Document any external behavior in the [README](README.md). +Document any external behavior in the [README](../README.md). #### Commit Changes @@ -106,7 +106,7 @@ git push origin my-feature-branch -f #### Update CHANGELOG -Update the [CHANGELOG](CHANGELOG.md) with a description of what you have changed. +Update the [CHANGELOG](../CHANGELOG.md) with a description of what you have changed. #### Check on Your Pull Request diff --git a/lib/concurrent-ruby/concurrent/mvar.rb b/lib/concurrent-ruby/concurrent/mvar.rb index dfc41950c..9777ba347 100644 --- a/lib/concurrent-ruby/concurrent/mvar.rb +++ b/lib/concurrent-ruby/concurrent/mvar.rb @@ -9,7 +9,7 @@ module Concurrent # queue of length one, or a special kind of mutable variable. # # On top of the fundamental `#put` and `#take` operations, we also provide a - # `#mutate` that is atomic with respect to operations on the same instance. + # `#modify` that is atomic with respect to operations on the same instance. # These operations all support timeouts. # # We also support non-blocking operations `#try_put!` and `#try_take!`, a @@ -87,7 +87,7 @@ def borrow(timeout = nil) @mutex.synchronize do wait_for_full(timeout) - # if we timeoud out we'll still be empty + # If we timed out we'll still be empty if unlocked_full? yield @value else @@ -116,10 +116,10 @@ def put(value, timeout = nil) end # Atomically `take`, yield the value to a block for transformation, and then - # `put` the transformed value. Returns the transformed value. A timeout can + # `put` the transformed value. Returns the pre-transform value. A timeout can # be set to limit the time spent blocked, in which case it returns `TIMEOUT` # if the time is exceeded. - # @return [Object] the transformed value, or `TIMEOUT` + # @return [Object] the pre-transform value, or `TIMEOUT` def modify(timeout = nil) raise ArgumentError.new('no block given') unless block_given? From 8d8a29c43e2d766ff09e1b767ec82131de57d8f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 02:06:11 +0000 Subject: [PATCH 08/10] Bump actions/upload-pages-artifact from 3 to 4 Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-pages-artifact/releases) - [Commits](https://github.com/actions/upload-pages-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-pages-artifact dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 780f0741c..18d7cd29f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,7 +29,7 @@ jobs: - run: ruby support/generate_docs.rb - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: docs From 4eb01b962257968ccb91ee4fe7f27c30f2899932 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 21:21:29 +0000 Subject: [PATCH 09/10] Bump actions/checkout from 4 to 5 Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- .github/workflows/docs.yml | 2 +- .github/workflows/experimental.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 093571fa6..b5724f575 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: @@ -42,7 +42,7 @@ jobs: env: RUBYOPT: '-w' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: ruby/setup-ruby@v1 with: ruby-version: ruby @@ -61,7 +61,7 @@ jobs: env: RUBYOPT: '-w' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 18d7cd29f..2ed493ffb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: env: BUNDLE_WITH: "documentation" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/experimental.yml b/.github/workflows/experimental.yml index 28048747c..d31d54be9 100644 --- a/.github/workflows/experimental.yml +++ b/.github/workflows/experimental.yml @@ -21,7 +21,7 @@ jobs: name: "Tests: Experimental Ruby ${{ matrix.ruby }}" steps: - name: Clone Repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: From 05523c01f6f2eebcb7579c2b8efc29e595010bb0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 17 Sep 2025 21:59:37 +0200 Subject: [PATCH 10/10] Avoid creating a Fiber while loading the gem * Since creating a Fiber can be quite expensive and might not work on some platforms (though those are bugs): https://bugs.ruby-lang.org/issues/20085 https://bugs.ruby-lang.org/issues/21607 * spec/concurrent/atomic/lock_local_var_spec.rb already checks that the shortcut is correct and matches the reality. --- lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb b/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb index ebf23a241..c367d2622 100644 --- a/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb +++ b/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb @@ -6,6 +6,7 @@ module Concurrent # @!visibility private def self.mutex_owned_per_thread? return false if Concurrent.on_jruby? || Concurrent.on_truffleruby? + return RUBY_VERSION < "3.0" if Concurrent.on_cruby? mutex = Mutex.new # Lock the mutex: