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

ruby-changes:50878

From: ko1 <ko1@a...>
Date: Wed, 4 Apr 2018 14:00:58 +0900 (JST)
Subject: [ruby-changes:50878] ko1:r63085 (trunk): use Queue for inter-thread synchronization.

ko1	2018-04-04 14:00:52 +0900 (Wed, 04 Apr 2018)

  New Revision: 63085

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

  Log:
    use Queue for inter-thread synchronization.
    
    * test/ruby/test_bignum.rb (test_interrupt_during_to_s): should not use
      "while" synchronization, but should use Queue.

  Modified files:
    trunk/test/ruby/test_bignum.rb
Index: test/ruby/test_bignum.rb
===================================================================
--- test/ruby/test_bignum.rb	(revision 63084)
+++ test/ruby/test_bignum.rb	(revision 63085)
@@ -615,14 +615,15 @@ class TestBignum < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_bignum.rb#L615
     start_flag = false
     end_flag = false
     num = (65536 ** 65536)
+    q = Queue.new
     thread = Thread.new do
-      start_flag = true
       assert_raise(RuntimeError) {
+        q << true
         num.to_s
         end_flag = true
       }
     end
-    sleep 0.001 until start_flag
+    q.pop # sync
     thread.raise
     thread.join
     time = Time.now - time

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

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