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

ruby-changes:44077

From: ko1 <ko1@a...>
Date: Tue, 13 Sep 2016 18:39:13 +0900 (JST)
Subject: [ruby-changes:44077] ko1:r56150 (trunk): * test/ruby/test_exception.rb: fix thread issues.

ko1	2016-09-13 18:39:08 +0900 (Tue, 13 Sep 2016)

  New Revision: 56150

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

  Log:
    * test/ruby/test_exception.rb: fix thread issues.
      * use Queue instead of a local variable for synchronization.
      * join created thread to soleve leaking threads warning.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_exception.rb
Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb	(revision 56149)
+++ test/ruby/test_exception.rb	(revision 56150)
@@ -723,9 +723,9 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L723
     bug12741 = '[ruby-core:77222] [Bug #12741]'
 
     x = Thread.current
-    a = false
+    q = Queue.new
     y = Thread.start do
-      Thread.pass until a
+      q.pop
       begin
         raise "caller's cause"
       rescue
@@ -737,9 +737,11 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L737
       raise bug12741
     rescue
       e = assert_raise_with_message(RuntimeError, "stop") do
-        a = true
+        q.push(true)
         sleep 1
       end
+    ensure
+      y.join
     end
     assert_equal("caller's cause", e.cause.message)
   end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56149)
+++ ChangeLog	(revision 56150)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Sep 13 18:37:08 2016  Koichi Sasada  <ko1@a...>
+
+	* test/ruby/test_exception.rb: fix thread issues.
+	  * use Queue instead of a local variable for synchronization.
+	  * join created thread to soleve leaking threads warning.
+
 Tue Sep 13 16:07:26 2016  Kazuki Yamaguchi  <k@r...>
 
 	* string.c (rb_str_set_len): The buffer overflow check is wrong. The

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

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