From 59a6ed8cc10e11720cb3eaea8d4750d29cd61167 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 20 Mar 2018 02:08:27 +0000 Subject: merge revision(s) 62668: [Backport #14578] thread.c: reset waitq of keeping mutexes in child We must not maintain references to threads in the parent process in any mutexes held by the child process. * thread_sync.c (rb_mutex_cleanup_keeping_mutexes): new function * thread.c (rb_thread_atfork): cleanup keeping mutexes [ruby-core:85940] [Bug #14578] Fixes: r58604 (commit 3586c9e0876e784767a1c1adba9ebc2499fa0ec2) ("reduce rb_mutex_t size from 160 to 80 bytes on 64-bit") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_thread.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 591292962d..135d17237e 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -1188,6 +1188,17 @@ q.pop assert_predicate(status, :success?, bug9751) end if Process.respond_to?(:fork) + def test_fork_while_locked + m = Mutex.new + thrs = [] + 3.times do |i| + thrs << Thread.new { m.synchronize { Process.waitpid2(fork{})[1] } } + end + thrs.each do |t| + assert_predicate t.value, :success?, '[ruby-core:85940] [Bug #14578]' + end + end if Process.respond_to?(:fork) + def test_subclass_no_initialize t = Module.new do break eval("class C\u{30b9 30ec 30c3 30c9} < Thread; self; end") -- cgit v1.2.3