mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Test fifo without sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1ed7fdf1fa
commit
2abf47bff9
1 changed files with 11 additions and 5 deletions
|
@ -3182,12 +3182,18 @@ End
|
||||||
mkcdtmpdir {
|
mkcdtmpdir {
|
||||||
assert(system("mkfifo", "fifo"), "mkfifo fails")
|
assert(system("mkfifo", "fifo"), "mkfifo fails")
|
||||||
assert_separately([], <<-'EOS')
|
assert_separately([], <<-'EOS')
|
||||||
t = Thread.new {
|
t1 = Thread.new {
|
||||||
open("fifo") {}
|
open("fifo", "r") {|r|
|
||||||
|
r.read
|
||||||
}
|
}
|
||||||
sleep 0.1 until t.status == "sleep"
|
}
|
||||||
sleep 0.1
|
t2 = Thread.new {
|
||||||
assert(true)
|
open("fifo", "w") {|w|
|
||||||
|
w.write "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t1_value, _ = assert_join_threads([t1, t2])
|
||||||
|
assert_equal("foo", t1_value)
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
end if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
|
end if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
|
||||||
|
|
Loading…
Reference in a new issue