summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2025-12-05 19:19:13 +0100
committergit <svn-admin@ruby-lang.org>2025-12-05 18:32:13 +0000
commitdc406af9cb9a269ae550483fa1278eedf297fb92 (patch)
treef35a00f9df030b09202e4784cc17276537f4c221
parenta523e9d872d51e64eecbf3feeaa8d4d8769f72bd (diff)
[ruby/timeout] Fix condition and fix test to catch that broken condition
https://github.com/ruby/timeout/commit/82fb6f6925
-rw-r--r--lib/timeout.rb4
-rw-r--r--test/test_timeout.rb2
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 3ad0193ac5..47410af386 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -72,7 +72,7 @@ module Timeout
end
if defined?(Ractor.store_if_absent) &&
- defined?(Ractor.shareble?) && Ractor.shareable?(GET_TIME)
+ defined?(Ractor.shareable?) && Ractor.shareable?(GET_TIME)
# Ractor support if
# 1. Ractor.store_if_absent is available
@@ -85,8 +85,6 @@ module Timeout
def self.instance
Ractor[:timeout_gem_state]
end
-
- ::Timeout::RACTOR_SUPPORT = true # for test
else
GLOBAL_STATE = State.new
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index 233f54eb82..3f94134fb0 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -299,5 +299,5 @@ class TestTimeout < Test::Unit::TestCase
assert_equal :ok, r
end;
- end if Timeout.const_defined?(:RACTOR_SUPPORT)
+ end if defined?(::Ractor) && RUBY_VERSION >= '4.0'
end