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

ruby-changes:51103

From: normal <ko1@a...>
Date: Tue, 1 May 2018 08:54:00 +0900 (JST)
Subject: [ruby-changes:51103] normal:r63310 (trunk): test/thread/test_cv.rb: test CV usability inside forked child

normal	2018-05-01 08:53:55 +0900 (Tue, 01 May 2018)

  New Revision: 63310

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

  Log:
    test/thread/test_cv.rb: test CV usability inside forked child
    
    * test/thread/test_cv.rb (def test_condvar_fork): new test
      [Bug #14725]

  Modified files:
    trunk/test/thread/test_cv.rb
Index: test/thread/test_cv.rb
===================================================================
--- test/thread/test_cv.rb	(revision 63309)
+++ test/thread/test_cv.rb	(revision 63310)
@@ -228,8 +228,14 @@ INPUT https://github.com/ruby/ruby/blob/trunk/test/thread/test_cv.rb#L228
     end
     thrs.each { 3.times { Thread.pass } }
     pid = fork do
-      mutex.synchronize { condvar.broadcast }
-      exit!(0)
+      th = Thread.new do
+        mutex.synchronize { condvar.wait(mutex) }
+        :ok
+      end
+      until th.join(0.01)
+        mutex.synchronize { condvar.broadcast }
+      end
+      exit!(th.value == :ok ? 0 : 1)
     end
     _, s = Process.waitpid2(pid)
     assert_predicate s, :success?, 'no segfault [ruby-core:86316] [Bug #14634]'

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

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