[前][次][番号順一覧][スレッド一覧]

ruby-changes:49260

From: ko1 <ko1@a...>
Date: Thu, 21 Dec 2017 08:49:36 +0900 (JST)
Subject: [ruby-changes:49260] ko1:r61375 (trunk): fix threading bug.

ko1	2017-12-21 08:49:30 +0900 (Thu, 21 Dec 2017)

  New Revision: 61375

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61375

  Log:
    fix threading bug.
    
    * spec/ruby/core/thread/element_set_spec.rb: `t` can be uninitialized.
      Use `Thread.current` explicitly.

  Modified files:
    trunk/spec/ruby/core/thread/element_set_spec.rb
Index: spec/ruby/core/thread/element_set_spec.rb
===================================================================
--- spec/ruby/core/thread/element_set_spec.rb	(revision 61374)
+++ spec/ruby/core/thread/element_set_spec.rb	(revision 61375)
@@ -9,9 +9,10 @@ describe "Thread#[]=" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/element_set_spec.rb#L9
   it "raises a RuntimeError if the thread is frozen" do
     running = false
     t = Thread.new do
-      t.freeze
+      th = Thread.current
+      th.freeze
       -> {
-        t[:foo] = "bar"
+        th[:foo] = "bar"
       }.should raise_error(RuntimeError, /frozen/)
     end
     t.join

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]