summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-12 05:22:28 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-12 05:22:28 +0000
commit2abf47bff9a9780f8640a7d89caef9915cbe6bd0 (patch)
tree05f5e5a993bb987afbbec708a8db3b2c794f05ae /test
parent1ed7fdf1fa97a167768534dddb5a393274937cca (diff)
Test fifo without sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 11ef5252e6..a06fce8eb9 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -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