test/ruby/test_io.rb (test_select_leak): use handle_interrupt

Interrupt timing is tricky and it's possible the target
thread is still stopped from the previous loop iteration.

[ruby-core:88732] [Bug #15043]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-08-29 19:47:14 +00:00
parent ac543abe91
commit f1119509e6

View File

@ -3839,12 +3839,14 @@ __END__
Thread.new { IO.select(rset, wset, nil, 0) }.join Thread.new { IO.select(rset, wset, nil, 0) }.join
end; end;
th = Thread.new do th = Thread.new do
Thread.handle_interrupt(StandardError => :on_blocking) do
begin begin
IO.select(rset, wset) IO.select(rset, wset)
rescue rescue
retry retry
end while true end while true
end end
end
50_000.times do 50_000.times do
Thread.pass until th.stop? Thread.pass until th.stop?
th.raise(exc) th.raise(exc)