1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add multi-threaded I/O test.

This commit is contained in:
Samuel Williams 2020-07-18 17:34:54 +12:00
parent e6e9cef06e
commit 9f6a3d0306
Notes: git 2020-07-20 10:21:25 +09:00

View file

@ -39,4 +39,27 @@ class TestFiberIO < Test::Unit::TestCase
assert_predicate(i, :closed?)
assert_predicate(o, :closed?)
end
def test_heavy_read
skip unless defined?(UNIXSocket)
16.times.map do
thread = Thread.new do
i, o = UNIXSocket.pair
scheduler = Scheduler.new
Thread.current.scheduler = scheduler
Fiber do
message = i.read(20)
i.close
end
Fiber do
o.write("Hello World")
o.close
end
end
end.each(&:join)
end
end