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 {
|
||||
assert(system("mkfifo", "fifo"), "mkfifo fails")
|
||||
assert_separately([], <<-'EOS')
|
||||
t = Thread.new {
|
||||
open("fifo") {}
|
||||
t1 = Thread.new {
|
||||
open("fifo", "r") {|r|
|
||||
r.read
|
||||
}
|
||||
}
|
||||
sleep 0.1 until t.status == "sleep"
|
||||
sleep 0.1
|
||||
assert(true)
|
||||
t2 = Thread.new {
|
||||
open("fifo", "w") {|w|
|
||||
w.write "foo"
|
||||
}
|
||||
}
|
||||
t1_value, _ = assert_join_threads([t1, t2])
|
||||
assert_equal("foo", t1_value)
|
||||
EOS
|
||||
}
|
||||
end if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
|
||||
|
|
Loading…
Reference in a new issue