summaryrefslogtreecommitdiff
path: root/test/thread
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-30 23:53:55 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-30 23:53:55 +0000
commitf5db4a0cc240d36588a167aec1bf0be891e56435 (patch)
treee505c339a8e5975918e3464ff18d798e12570709 /test/thread
parentd2f52a5fb7835c299d0b769e2d0423d80c522fc8 (diff)
test/thread/test_cv.rb: test CV usability inside forked child
* test/thread/test_cv.rb (def test_condvar_fork): new test [Bug #14725] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/thread')
-rw-r--r--test/thread/test_cv.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/thread/test_cv.rb b/test/thread/test_cv.rb
index a093f373b18..b010b1fe5cf 100644
--- a/test/thread/test_cv.rb
+++ b/test/thread/test_cv.rb
@@ -228,8 +228,14 @@ INPUT
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]'