ruby-changes:46995
From: nobu <ko1@a...>
Date: Sun, 18 Jun 2017 13:29:09 +0900 (JST)
Subject: [ruby-changes:46995] nobu:r59110 (trunk): test/unit.rb: close jobserver
nobu 2017-06-18 13:29:04 +0900 (Sun, 18 Jun 2017) New Revision: 59110 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59110 Log: test/unit.rb: close jobserver * test/lib/test/unit.rb (Test::Unit::Parallel#flush_job_tokens): close jobserver auth fds aflter flush, not to release tokens more than acquired. Modified files: trunk/test/lib/test/unit.rb Index: test/lib/test/unit.rb =================================================================== --- test/lib/test/unit.rb (revision 59109) +++ test/lib/test/unit.rb (revision 59110) @@ -292,8 +292,11 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L292 def flush_job_tokens if @jobserver - @jobserver[1] << @job_tokens - @job_tokens.clear + r, w = @jobserver.shift(2) + @jobserver = nil + w << @job_tokens.slice!(0..-1) + r.close + w.close end end @@ -317,8 +320,8 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L320 return unless @options[:parallel] return if @interrupt worker.close - if @jobserver and !@job_tokens.empty? - @jobserver[1] << @job_tokens.slice!(0) + if @jobserver and (token = @job_tokens.slice!(0)) + @jobserver[1] << token end @workers.delete(worker) @dead_workers << worker -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/