mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 01:54:00 +02:00
* 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
This commit is contained in:
parent
3e0becb42d
commit
f150ed1532
5 changed files with 56 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue