diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-12 12:55:00 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-12 12:55:00 +0000 |
| commit | 91036252bb18b6773a8c8e4190623d659261e4a5 (patch) | |
| tree | 78e3eb511963e6d7fa230f7937dd7e6346ba3ef0 | |
| parent | 8a4f4f204d9946fb6154409a43527eb53b672b51 (diff) | |
merge revision(s) 57595: [Backport #8996]
check thread deadness correctly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | test/ruby/test_thread.rb | 10 | ||||
| -rw-r--r-- | thread.c | 7 | ||||
| -rw-r--r-- | version.h | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 9daff2d866..d7b5dadf81 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -1160,4 +1160,14 @@ q.pop 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 @@ -2103,6 +2103,13 @@ rb_threadptr_raise(rb_thread_t *th, int argc, VALUE *argv) 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); @@ -1,6 +1,6 @@ #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 |
