mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (ruby_cleanup): set thread status to THREAD_KILLED
for preventing thr.raise. * test/ruby/test_thread.rb (test_main_thread_status_at_exit): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
863e087326
commit
9ace5c122e
3 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Nov 27 10:55:09 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* eval.c (ruby_cleanup): set thread status to THREAD_KILLED
|
||||
for preventing thr.raise.
|
||||
* test/ruby/test_thread.rb (test_main_thread_status_at_exit):
|
||||
test for the above.
|
||||
|
||||
Tue Nov 27 10:31:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread.c (rb_thread_terminate_all): suppress a warning.
|
||||
|
|
3
eval.c
3
eval.c
|
@ -159,6 +159,9 @@ ruby_cleanup(volatile int ex)
|
|||
rb_thread_t *th = GET_THREAD();
|
||||
int nerr;
|
||||
|
||||
/* protect from thread.raise */
|
||||
th->status = THREAD_KILLED;
|
||||
|
||||
rb_threadptr_interrupt(th);
|
||||
rb_threadptr_check_signal(th);
|
||||
PUSH_TAG();
|
||||
|
|
|
@ -889,4 +889,16 @@ class TestThreadGroup < Test::Unit::TestCase
|
|||
}.join
|
||||
end
|
||||
end
|
||||
|
||||
def test_main_thread_status_at_exit
|
||||
assert_in_out_err([], <<-INPUT, %w(false), [])
|
||||
Thread.new(Thread.current) {|mth|
|
||||
begin
|
||||
sleep 0.1
|
||||
ensure
|
||||
p mth.alive?
|
||||
end
|
||||
}
|
||||
INPUT
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue