From 5dc6d20cc3535f21cf267923f66b98fac1d93309 Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 3 Feb 2012 01:11:37 +0000 Subject: merge revision(s) r34038,34099: * thread_pthread.c (ubf_select): call rb_thread_wakeup_timer_thread() only when it is not timer_thread. [Bug #5757] [ruby-dev:44985] patched by Tomoyuki Chikanaga. * thread_pthread.c (ping_signal_thread_list): remove return value. * thread_pthread.c (check_signal_thread_list): add a new function to check if signal thread list is empty. * thread_pthread.c (thread_timer): check signal thread list after timer_thread_function(). main thread might be added into signal thread list during timer_thread_function(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_thread.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 57e02849b9..209d4b006f 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -685,4 +685,19 @@ class TestThreadGroup < Test::Unit::TestCase t.join assert_equal(nil, t.backtrace) end + + def test_thread_timer_and_interrupt + bug5757 = '[ruby-dev:44985]' + t0 = Time.now.to_f + pid = spawn(EnvUtil.rubybin, '-e', '$stdin.read') + sleep 1; + Process.kill(:SIGQUIT, pid) + Process.wait(pid) + s = $? + assert_equal([false, true, false], + [s.exited?, s.signaled?, s.stopped?], + "[s.exited?, s.signaled?, s.stopped?]") + t1 = Time.now.to_f + assert_in_delta(t1 - t0, 1, 1) + end end -- cgit v1.2.3