File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -172,23 +172,17 @@ def test_threadgroup
172
172
end;
173
173
end
174
174
175
+ # https://github.com/ruby/timeout/issues/24
175
176
def test_handling_enclosed_threadgroup
176
- # The problem "add: can't move from the enclosed thread group" #24,
177
- # happens when the timeout_thread is created in an enclosed ThreadGroup.
178
177
assert_separately ( %w[ -rtimeout ] , <<-'end;' )
179
- t1 = Thread.new {
180
- Thread.stop
181
- assert_block do
182
- Timeout.timeout(0.1) {}
183
- true
184
- end
185
- }
186
- sleep 0.1 while t1.status != 'sleep'
187
- group = ThreadGroup.new
188
- group.add(t1)
189
- group.enclose
190
- t1.run
191
- t1.join
178
+ Thread.new {
179
+ t = Thread.current
180
+ group = ThreadGroup.new
181
+ group.add(t)
182
+ group.enclose
183
+
184
+ assert_equal 42, Timeout.timeout(1) { 42 }
185
+ }.join
192
186
end;
193
187
end
194
188
end
You can’t perform that action at this time.
0 commit comments