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 bd25f4b commit c4f1385Copy full SHA for c4f1385
lib/timeout.rb
@@ -120,6 +120,7 @@ def self.create_timeout_thread
120
requests.reject!(&:done?)
121
end
122
123
+ ThreadGroup::Default.add(watcher)
124
watcher.name = "Timeout stdlib thread"
125
watcher.thread_variable_set(:"\0__detached_thread__", true)
126
watcher
test/test_timeout.rb
@@ -159,4 +159,17 @@ def test_fork
159
assert_equal 'timeout', r.read
160
r.close
161
162
+
163
+ def test_threadgroup
164
+ assert_separately(%w[-rtimeout], <<-'end;')
165
+ tg = ThreadGroup.new
166
+ thr = Thread.new do
167
+ tg.add(Thread.current)
168
+ Timeout.timeout(10){}
169
+ end
170
+ thr.join
171
+ assert_equal [].to_s, tg.list.to_s
172
+ end;
173
174
175
0 commit comments