ruby-changes:45833
From: naruse <ko1@a...>
Date: Sun, 12 Mar 2017 21:55:06 +0900 (JST)
Subject: [ruby-changes:45833] naruse:r57906 (ruby_2_4): merge revision(s) 57595: [Backport #8996]
naruse 2017-03-12 21:55:00 +0900 (Sun, 12 Mar 2017) New Revision: 57906 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57906 Log: merge revision(s) 57595: [Backport #8996] check thread deadness correctly. Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/test/ruby/test_thread.rb branches/ruby_2_4/thread.c branches/ruby_2_4/version.h Index: ruby_2_4/test/ruby/test_thread.rb =================================================================== --- ruby_2_4/test/ruby/test_thread.rb (revision 57905) +++ ruby_2_4/test/ruby/test_thread.rb (revision 57906) @@ -1160,4 +1160,14 @@ q.pop https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_thread.rb#L1160 c = Class.new(Thread) {def initialize() self.name = "foo"; super; end} assert_equal("foo", c.new {Thread.current.name}.value, bug12290) end + + def test_thread_interrupt_for_killed_thread + assert_normal_exit(<<-_end, '[Bug #8996]', timeout: 5, timeout_error: nil) + trap(:TERM){exit} + while true + t = Thread.new{sleep 0} + t.raise Interrupt + end + _end + end end Index: ruby_2_4/thread.c =================================================================== --- ruby_2_4/thread.c (revision 57905) +++ ruby_2_4/thread.c (revision 57906) @@ -2103,6 +2103,13 @@ rb_threadptr_raise(rb_thread_t *th, int https://github.com/ruby/ruby/blob/trunk/ruby_2_4/thread.c#L2103 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_4/version.h =================================================================== --- ruby_2_4/version.h (revision 57905) +++ ruby_2_4/version.h (revision 57906) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.0" #define RUBY_RELEASE_DATE "2017-03-12" -#define RUBY_PATCHLEVEL 63 +#define RUBY_PATCHLEVEL 64 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 3 Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r57595 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/