We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1d784c commit 281b250Copy full SHA for 281b250
lib/timeout.rb
@@ -46,16 +46,11 @@ def self.handle_timeout(message) # :nodoc:
46
# :stopdoc:
47
48
# We keep a private reference so that time mocking libraries won't break Timeout.
49
- GET_TIME =
50
- if defined?(Ractor.make_shareable)
51
- begin
52
- Ractor.make_shareable(Process.method(:clock_gettime))
53
- rescue # failed on Ruby 3.4
54
- Process.method(:clock_gettime)
55
- end
56
- else
57
58
+ GET_TIME = Process.method(:clock_gettime)
+ if defined?(Ractor.make_shareable)
+ # Ractor.make_shareable(Method) only works on Ruby 4+
+ Ractor.make_shareable(GET_TIME) rescue nil
+ end
59
private_constant :GET_TIME
60
61
class State
0 commit comments