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

ruby-changes:38870

From: normal <ko1@a...>
Date: Thu, 18 Jun 2015 18:26:11 +0900 (JST)
Subject: [ruby-changes:38870] normal:r50951 (trunk): test/socket/test_unix.rb: replace sleep with select

normal	2015-06-18 18:25:37 +0900 (Thu, 18 Jun 2015)

  New Revision: 50951

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

  Log:
    test/socket/test_unix.rb: replace sleep with select
    
    Not sure what drugs I was on, but blindly sleeping instead of
    using IO#wait or IO.select to wait for data on a socket is
    completely wrong.

  Modified files:
    trunk/ChangeLog
    trunk/test/socket/test_unix.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50950)
+++ ChangeLog	(revision 50951)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 18 18:24:12 2015  Eric Wong  <e@8...>
+
+	* test/socket/test_unix.rb: replace sleep with select
+
 Thu Jun 18 17:59:06 2015  Koichi Sasada  <ko1@a...>
 
 	* vm.c (rb_vm_control_frame_id_and_class): remove usless codes.
Index: test/socket/test_unix.rb
===================================================================
--- test/socket/test_unix.rb	(revision 50950)
+++ test/socket/test_unix.rb	(revision 50951)
@@ -388,7 +388,7 @@ class TestSocket_UNIXSocket < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L388
 
     buf = ""
     s2.send("BBBBBB", 0)
-    sleep 0.1
+    IO.select([s1])
     rv = s1.recv(100, 0, buf)
     assert_equal buf.object_id, rv.object_id
     assert_equal "BBBBBB", rv

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

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