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

ruby-changes:27636

From: kosaki <ko1@a...>
Date: Sun, 10 Mar 2013 13:00:59 +0900 (JST)
Subject: [ruby-changes:27636] kosaki:r39688 (trunk): * test/thread/test_queue.rb (TestQueue#test_thr_kill): reduce

kosaki	2013-03-10 13:00:44 +0900 (Sun, 10 Mar 2013)

  New Revision: 39688

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

  Log:
    * test/thread/test_queue.rb (TestQueue#test_thr_kill): reduce
      iterations from 2000 to 250. When running on uniprocessor
      systems, every th.kill needs TIME_QUANTUM_USEC time (i.e.
      100msec on posix systems). Because, "r.read 1" is 3 steps
      operations that 1) release GVL 2) read 3) acquire gvl and
      (1) invoke context switch to main thread. and then, main
      thread's th.kill resume (1), but not (2). Thus read interrupt
      need TIME_QUANTUM_USEC. Then maximum iteration is 30sec/100msec
      = 300.

  Modified files:
    trunk/ChangeLog
    trunk/test/thread/test_queue.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39687)
+++ ChangeLog	(revision 39688)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Mar  7 01:17:00 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* test/thread/test_queue.rb (TestQueue#test_thr_kill): reduce
+	  iterations from 2000 to 250. When running on uniprocessor
+	  systems, every th.kill needs TIME_QUANTUM_USEC time (i.e.
+	  100msec on posix systems). Because, "r.read 1" is 3 steps
+	  operations that 1) release GVL 2) read 3) acquire gvl and
+	  (1) invoke context switch to main thread. and then, main
+	  thread's th.kill resume (1), but not (2). Thus read interrupt
+	  need TIME_QUANTUM_USEC. Then maximum iteration is 30sec/100msec
+	  = 300.
+
 Thu Mar  7 00:14:51 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* io.c (rb_update_max_fd): use ATOMIC_CAS because this function
Index: test/thread/test_queue.rb
===================================================================
--- test/thread/test_queue.rb	(revision 39687)
+++ test/thread/test_queue.rb	(revision 39688)
@@ -85,7 +85,7 @@ class TestQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L85
     bug5343 = '[ruby-core:39634]'
     Dir.mktmpdir {|d|
       timeout = 30
-      total_count = 2000
+      total_count = 250
       begin
         assert_normal_exit(<<-"_eom", bug5343, {:timeout => timeout, :chdir=>d})
           require "thread"
@@ -98,7 +98,8 @@ class TestQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L98
               r.read 1
             }
             queue.pop
-            th.kill.join
+            th.kill
+            th.join
           end
         _eom
       rescue Timeout::Error

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

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