[前][次][番号順一覧][スレッド一覧]

ruby-changes:38187

From: akr <ko1@a...>
Date: Sun, 12 Apr 2015 23:22:03 +0900 (JST)
Subject: [ruby-changes:38187] akr:r50259 (trunk): Test fifo without sleep.

akr	2015-04-12 14:22:28 +0900 (Sun, 12 Apr 2015)

  New Revision: 50259

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50259

  Log:
    Test fifo without sleep.

  Modified files:
    trunk/test/ruby/test_io.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 50258)
+++ test/ruby/test_io.rb	(revision 50259)
@@ -3182,12 +3182,18 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3182
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]