diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-26 08:05:49 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-26 08:05:49 +0000 |
commit | f150ed1532e727c409cc018a98e1362a8c71242c (patch) | |
tree | 30e5bf9c717ff8b17867b7b5585f32a12952bc7c /test/ruby/test_thread.rb | |
parent | 3e0becb42d73be66cd60a0694554eb014b1b6552 (diff) | |
download | ruby-f150ed1532e727c409cc018a98e1362a8c71242c.tar.gz |
* vm_core.h (rb_thread_struct): added 'in_trap' member for marking
running trap handler.
* signal.c (signal_exec): turn on in_trap when running trap.
* thread.c (Init_Thread, thread_create_core): initialize in_trap
when creating new threads.
* thread.c (thread_join_m): raise ThreadError when running trap
handler.Bug [#6416][ruby-core:44956]
* test/ruby/test_thread.rb (test_thread_join_in_trap): new test
for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_thread.rb')
-rw-r--r-- | test/ruby/test_thread.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 145e021790..518ad40333 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -863,4 +863,19 @@ class TestThreadGroup < Test::Unit::TestCase end assert_in_delta(t1 - t0, 1, 1, bug5757) end + + def test_thread_join_in_trap + assert_raise(ThreadError) { + t = Thread.new{ sleep 0.2; Process.kill(:INT, $$) } + + Signal.trap :INT do + t.join + end + + t.join + } + end + + + end |