diff options
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 1bf160f2f7..4d712ed099 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -3177,4 +3177,34 @@ End end end end + + def test_race_gets_and_close + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + bug13076 = '[ruby-core:78845] [Bug #13076]' + begin; + 100.times do |i| + a = [] + t = [] + 10.times do + r,w = IO.pipe + a << [r,w] + t << Thread.new do + begin + while r.gets + end + rescue IOError + end + end + end + a.each do |r,w| + w.puts "hoge" + w.close + r.close + end + assert_nothing_raised(IOError, bug13076) { + t.each(&:join) + } + end + end; + end end |