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

ruby-changes:39960

From: eregon <ko1@a...>
Date: Mon, 5 Oct 2015 20:44:37 +0900 (JST)
Subject: [ruby-changes:39960] eregon:r52041 (trunk): * test/ruby/test_thread.rb: fix potential race condition.

eregon	2015-10-05 20:44:30 +0900 (Mon, 05 Oct 2015)

  New Revision: 52041

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

  Log:
    * test/ruby/test_thread.rb: fix potential race condition.
      The thread could have a "sleep" status because it tries
      to acquire the mutex, but does not have it yet.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_thread.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52040)
+++ ChangeLog	(revision 52041)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Oct  5 20:39:32 2015  Benoit Daloze  <eregontp@g...>
+
+	* test/ruby/test_thread.rb: fix potential race condition.
+	  The thread could have a "sleep" status because it tries
+	  to acquire the mutex, but does not have it yet.
+
 Mon Oct  5 15:39:30 2015  Zachary Scott  <zzak@r...>
 
 	* numeric.c: [DOC] Overview for Numeric class by Joe Corcoran
Index: test/ruby/test_thread.rb
===================================================================
--- test/ruby/test_thread.rb	(revision 52040)
+++ test/ruby/test_thread.rb	(revision 52041)
@@ -914,9 +914,8 @@ q.pop https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L914
         sleep
       }
 
-      Thread.pass until th.status == "sleep"
-      # acquired another thread.
-      assert_equal(mutex.locked?, true)
+      # acquired by another thread.
+      Thread.pass until mutex.locked?
       assert_equal(mutex.owned?, false)
     ensure
       th.kill if th

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

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