1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
normal 2018-04-30 23:53:55 +00:00
parent d2f52a5fb7
commit f5db4a0cc2

View file

@ -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]'