diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-12 05:22:28 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-12 05:22:28 +0000 |
commit | 2abf47bff9a9780f8640a7d89caef9915cbe6bd0 (patch) | |
tree | 05f5e5a993bb987afbbec708a8db3b2c794f05ae | |
parent | 1ed7fdf1fa97a167768534dddb5a393274937cca (diff) | |
download | ruby-2abf47bff9a9780f8640a7d89caef9915cbe6bd0.tar.gz |
Test fifo without sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_io.rb | 16 |
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 |