ruby-changes:46037
From: usa <ko1@a...>
Date: Sun, 26 Mar 2017 02:27:43 +0900 (JST)
Subject: [ruby-changes:46037] usa:r58108 (ruby_2_2): merge revision(s) 57595: [Backport #8996]
usa 2017-03-26 02:27:37 +0900 (Sun, 26 Mar 2017) New Revision: 58108 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58108 Log: merge revision(s) 57595: [Backport #8996] check thread deadness correctly. Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/test/ruby/test_thread.rb branches/ruby_2_2/thread.c branches/ruby_2_2/version.h Index: ruby_2_2/thread.c =================================================================== --- ruby_2_2/thread.c (revision 58107) +++ ruby_2_2/thread.c (revision 58108) @@ -2063,6 +2063,13 @@ rb_threadptr_raise(rb_thread_t *th, int https://github.com/ruby/ruby/blob/trunk/ruby_2_2/thread.c#L2063 else { exc = rb_make_exception(argc, argv); } + + /* making an exception object can switch thread, + so we need to check thread deadness again */ + if (rb_threadptr_dead(th)) { + return Qnil; + } + rb_threadptr_setup_exception(GET_THREAD(), exc, Qundef); rb_threadptr_pending_interrupt_enque(th, exc); rb_threadptr_interrupt(th); Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 58107) +++ ruby_2_2/version.h (revision 58108) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.7" #define RUBY_RELEASE_DATE "2017-03-26" -#define RUBY_PATCHLEVEL 440 +#define RUBY_PATCHLEVEL 441 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_2/test/ruby/test_thread.rb =================================================================== --- ruby_2_2/test/ruby/test_thread.rb (revision 58107) +++ ruby_2_2/test/ruby/test_thread.rb (revision 58108) @@ -1048,4 +1048,14 @@ q.pop https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_thread.rb#L1048 assert_not_predicate(status, :signaled?, FailDesc[status, bug9751, output]) assert_predicate(status, :success?, bug9751) end if Process.respond_to?(:fork) + + def test_thread_interrupt_for_killed_thread + assert_normal_exit(<<-_end, '[Bug #8996]', timeout: 5) + trap(/mswin|mignw/ =~ RUBY_PLATFORM ? :KILL : :TERM){exit} + while true + t = Thread.new{sleep 0} + t.raise Interrupt + end + _end + end end Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r57595 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/