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

ruby-changes:34574

From: nobu <ko1@a...>
Date: Wed, 2 Jul 2014 16:59:39 +0900 (JST)
Subject: [ruby-changes:34574] nobu:r46655 (trunk): test_io.rb: fix leaked threads

nobu	2014-07-02 16:59:31 +0900 (Wed, 02 Jul 2014)

  New Revision: 46655

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

  Log:
    test_io.rb: fix leaked threads
    
    * test/ruby/test_io.rb (test_readpartial_locktmp): ensure reading
      thread is dead to fix leaked threads.

  Modified files:
    trunk/test/ruby/test_io.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 46654)
+++ test/ruby/test_io.rb	(revision 46655)
@@ -2853,6 +2853,7 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2853
     bug6099 = '[ruby-dev:45297]'
     buf = " " * 100
     data = "a" * 100
+    th = nil
     with_pipe do |r,w|
       r.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
       th = Thread.new {r.readpartial(100, buf)}
@@ -2865,6 +2866,8 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2866
     end
     assert_equal(data, buf, bug6099)
   rescue RuntimeError # can't modify string; temporarily locked
+  ensure
+    th.join if th
   end
 
   def test_advise_pipe

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

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