summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 16:07:07 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 16:07:07 +0000
commit260d1ac2ca8711971c48e14bd535aeeb20f6ed1d (patch)
treeefc07355499fc1baedbfeab41893d0e2edd214d7 /test/ruby
parent59d521ade472e31affb1b3e925343adb95c89dd8 (diff)
merge revision(s) 54598,54600: [Backport #12290]
* thread.c (get_initialized_threadptr): extract ensuring that the thread is initialized. * thread.c (rb_thread_setname): thread must be initialized to set the name. [ruby-core:74963] [Bug #12290] * thread.c (rb_thread_setname): defer setting native thread name set in initialize until the native thread is created. [ruby-core:74963] [Bug #12290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_thread.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index dc929ce4fd..c90c369bb7 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -1082,4 +1082,10 @@ q.pop
t.kill
t.join
end
+
+ def test_thread_setname_in_initialize
+ bug12290 = '[ruby-core:74963] [Bug #12290]'
+ c = Class.new(Thread) {def initialize() self.name = "foo"; super; end}
+ assert_equal("foo", c.new {Thread.current.name}.value)
+ end
end