2007-11-27 17:53:28 -05:00
|
|
|
assert_finish 5, %q{
|
2007-11-25 20:20:48 -05:00
|
|
|
r, w = IO.pipe
|
|
|
|
t1 = Thread.new { r.sysread(1) }
|
|
|
|
t2 = Thread.new { r.sysread(1) }
|
|
|
|
sleep 0.1
|
|
|
|
w.write "a"
|
|
|
|
sleep 0.1
|
|
|
|
w.write "a"
|
|
|
|
}, '[ruby-dev:31866]'
|
2007-12-21 04:43:49 -05:00
|
|
|
|
|
|
|
assert_finish 10, %q{
|
|
|
|
require "io/nonblock"
|
|
|
|
r, w = IO.pipe
|
|
|
|
w.nonblock = true
|
|
|
|
w.write_nonblock("a" * 100000)
|
|
|
|
w.nonblock = false
|
|
|
|
t1 = Thread.new { w.write("b" * 4096) }
|
|
|
|
t2 = Thread.new { w.write("c" * 4096) }
|
|
|
|
sleep 0.5
|
|
|
|
r.sysread(4096).length
|
|
|
|
sleep 0.5
|
|
|
|
r.sysread(4096).length
|
|
|
|
t1.join
|
|
|
|
t2.join
|
|
|
|
}, '[ruby-dev:32566]'
|