From fa4514e4fedc1e1390200e3901e2add22a4a27b4 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 30 Jun 2011 22:29:34 +0000 Subject: * thread.c (rb_threadptr_check_signal): only wake up main thread. * thread.c (rb_threadptr_execute_interrupts_common): check signal deliverly if it is main thread. fixes [ruby-dev:44005] [Ruby 1.9 - Bug #4950] * bootstraptest/test_fork.rb: add a test for above. * signal.c (rb_get_next_signal): skip if signal_buff is empty. (check signal_buff.size first) * vm_core.h: remove unused variable rb_thread_t::exec_signal. * thread.c (rb_thread_check_trap_pending): check rb_signal_buff_size() because rb_thread_t::exec_signal is no longer available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_fork.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bootstraptest/test_fork.rb') diff --git a/bootstraptest/test_fork.rb b/bootstraptest/test_fork.rb index d9e92c7a6b..384294727f 100644 --- a/bootstraptest/test_fork.rb +++ b/bootstraptest/test_fork.rb @@ -47,3 +47,23 @@ assert_equal 'ok', %q{ :ok end }, '[ruby-core:28924]' + +assert_equal '[1, 2]', %q{ + a = [] + trap(:INT) { a.push(1) } + trap(:TERM) { a.push(2) } + pid = $$ + begin + fork do + sleep 0.5 + Process.kill(:INT, pid) + Process.kill(:TERM, pid) + end + + sleep 1 + a.sort + rescue NotImplementedError + [1, 2] + end +}, '[ruby-dev:44005] [Ruby 1.9 - Bug #4950]' + -- cgit v1.2.3