ruby-changes:48025
From: kazu <ko1@a...>
Date: Sun, 8 Oct 2017 16:00:09 +0900 (JST)
Subject: [ruby-changes:48025] kazu:r60139 (trunk): Remove unnecessary `require 'thread'`
kazu 2017-10-08 16:00:01 +0900 (Sun, 08 Oct 2017) New Revision: 60139 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60139 Log: Remove unnecessary `require 'thread'` Modified files: trunk/lib/drb/drb.rb trunk/lib/drb/extservm.rb trunk/lib/irb/ext/multi-irb.rb trunk/lib/irb/workspace.rb trunk/lib/monitor.rb trunk/lib/mutex_m.rb trunk/lib/rinda/rinda.rb trunk/lib/rinda/ring.rb trunk/lib/rinda/tuplespace.rb trunk/lib/shell/command-processor.rb trunk/lib/shell/process-controller.rb trunk/lib/singleton.rb trunk/lib/thwait.rb trunk/lib/tracer.rb trunk/lib/webrick/httpservlet/abstract.rb trunk/lib/webrick/httpservlet/filehandler.rb trunk/lib/webrick/server.rb trunk/lib/webrick/utils.rb trunk/sample/drb/dchats.rb trunk/sample/drb/dhasen.rb trunk/sample/drb/dlogd.rb trunk/sample/drb/dqueue.rb trunk/sample/drb/http0serv.rb trunk/sample/drb/name.rb trunk/sample/drb/old_tuplespace.rb trunk/sample/drb/ring_echo.rb trunk/sample/drb/simpletuple.rb trunk/sample/dualstack-httpd.rb trunk/sample/observ.rb trunk/sample/philos.rb trunk/test/-ext-/postponed_job/test_postponed_job.rb trunk/test/bigdecimal/test_bigdecimal.rb trunk/test/lib/test/unit.rb trunk/test/monitor/test_monitor.rb trunk/test/ruby/lbtest.rb trunk/test/ruby/test_autoload.rb trunk/test/ruby/test_backtrace.rb trunk/test/ruby/test_file.rb trunk/test/ruby/test_thread.rb trunk/test/ruby/test_threadgroup.rb trunk/test/socket/test_unix.rb trunk/test/test_mutex_m.rb trunk/test/test_tempfile.rb trunk/test/test_timeout.rb trunk/test/thread/test_cv.rb trunk/test/thread/test_queue.rb trunk/thread_sync.c Index: lib/webrick/httpservlet/abstract.rb =================================================================== --- lib/webrick/httpservlet/abstract.rb (revision 60138) +++ lib/webrick/httpservlet/abstract.rb (revision 60139) @@ -9,8 +9,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpservlet/abstract.rb#L9 # # $IPR: abstract.rb,v 1.24 2003/07/11 11:16:46 gotoyuzo Exp $ -require 'thread' - require 'webrick/htmlutils' require 'webrick/httputils' require 'webrick/httpstatus' Index: lib/webrick/server.rb =================================================================== --- lib/webrick/server.rb (revision 60138) +++ lib/webrick/server.rb (revision 60139) @@ -9,7 +9,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/webrick/server.rb#L9 # # $IPR: server.rb,v 1.62 2003/07/22 19:20:43 gotoyuzo Exp $ -require 'thread' require 'socket' require 'webrick/config' require 'webrick/log' Index: lib/irb/workspace.rb =================================================================== --- lib/irb/workspace.rb (revision 60138) +++ lib/irb/workspace.rb (revision 60139) @@ -39,8 +39,6 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/irb/workspace.rb#L39 when 2 # binding in loaded file(thread use) unless defined? BINDING_QUEUE - require "thread" - IRB.const_set(:BINDING_QUEUE, Thread::SizedQueue.new(1)) Thread.abort_on_exception = true Thread.start do Index: lib/mutex_m.rb =================================================================== --- lib/mutex_m.rb (revision 60138) +++ lib/mutex_m.rb (revision 60139) @@ -10,9 +10,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/mutex_m.rb#L10 # # -- - -require 'thread' - # = mutex_m.rb # # When 'mutex_m' is required, any object that extends or includes Mutex_m will Index: lib/shell/process-controller.rb =================================================================== --- lib/shell/process-controller.rb (revision 60138) +++ lib/shell/process-controller.rb (revision 60139) @@ -10,8 +10,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/shell/process-controller.rb#L10 # # require "forwardable" - -require "thread" require "sync" class Shell Index: sample/drb/name.rb =================================================================== --- sample/drb/name.rb (revision 60138) +++ sample/drb/name.rb (revision 60139) @@ -35,7 +35,6 @@ How to play. https://github.com/ruby/ruby/blob/trunk/sample/drb/name.rb#L35 | 2 =end -require 'thread.rb' require 'drb/drb' module DRbNamedObject Index: sample/drb/old_tuplespace.rb =================================================================== --- sample/drb/old_tuplespace.rb (revision 60138) +++ sample/drb/old_tuplespace.rb (revision 60139) @@ -3,8 +3,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/old_tuplespace.rb#L3 # Copyright (c) 1999-2000 Masatoshi SEKI # You can redistribute it and/or modify it under the same terms as Ruby. -require 'thread' - class TupleSpace class Template def initialize(list) Index: sample/drb/dhasen.rb =================================================================== --- sample/drb/dhasen.rb (revision 60138) +++ sample/drb/dhasen.rb (revision 60139) @@ -17,7 +17,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/dhasen.rb#L17 require 'drb/drb' require 'chasen' -require 'thread' class Dhasen include DRbUndumped Index: thread_sync.c =================================================================== --- thread_sync.c (revision 60138) +++ thread_sync.c (revision 60139) @@ -65,7 +65,6 @@ static const char* rb_mutex_unlock_th(rb https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L65 * * Example: * - * require 'thread' * semaphore = Mutex.new * * a = Thread.new { @@ -673,8 +672,7 @@ queue_closed_result(VALUE self, struct r https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L672 * * Example: * - * require 'thread' - * queue = Queue.new + * queue = Queue.new * * producer = Thread.new do * 5.times do |i| @@ -1211,8 +1209,6 @@ struct rb_condvar { https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1209 * * Example: * - * require 'thread' - * * mutex = Mutex.new * resource = ConditionVariable.new * Index: sample/drb/dqueue.rb =================================================================== --- sample/drb/dqueue.rb (revision 60138) +++ sample/drb/dqueue.rb (revision 60139) @@ -3,7 +3,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/dqueue.rb#L3 Copyright (c) 1999-2000 Masatoshi SEKI =end -require 'thread' require 'drb/drb' DRb.start_service(nil, Thread::Queue.new) Index: sample/drb/ring_echo.rb =================================================================== --- sample/drb/ring_echo.rb (revision 60138) +++ sample/drb/ring_echo.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/ring_echo.rb#L1 require 'drb/drb' require 'drb/eq' require 'rinda/ring' -require 'thread' class RingEcho include DRbUndumped Index: test/thread/test_queue.rb =================================================================== --- test/thread/test_queue.rb (revision 60138) +++ test/thread/test_queue.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L1 # frozen_string_literal: false require 'test/unit' -require 'thread' require 'tmpdir' require 'timeout' @@ -136,7 +135,6 @@ class TestQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L135 total_count = 250 begin assert_normal_exit(<<-"_eom", bug5343, {:timeout => timeout, :chdir=>d}) - require "thread" #{total_count}.times do |i| open("test_thr_kill_count", "w") {|f| f.puts i } queue = Queue.new Index: test/thread/test_cv.rb =================================================================== --- test/thread/test_cv.rb (revision 60138) +++ test/thread/test_cv.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/thread/test_cv.rb#L1 # frozen_string_literal: false require 'test/unit' -require 'thread' require 'tmpdir' class TestConditionVariable < Test::Unit::TestCase @@ -94,8 +93,6 @@ class TestConditionVariable < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/thread/test_cv.rb#L93 def test_condvar_wait_deadlock assert_in_out_err([], <<-INPUT, /\Afatal\nNo live threads left\. Deadlock/, []) - require "thread" - mutex = Mutex.new cv = ConditionVariable.new Index: test/test_timeout.rb =================================================================== --- test/test_timeout.rb (revision 60138) +++ test/test_timeout.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/test_timeout.rb#L1 # frozen_string_literal: false require 'test/unit' require 'timeout' -require 'thread' class TestTimeout < Test::Unit::TestCase def test_queue Index: test/-ext-/postponed_job/test_postponed_job.rb =================================================================== --- test/-ext-/postponed_job/test_postponed_job.rb (revision 60138) +++ test/-ext-/postponed_job/test_postponed_job.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/-ext-/postponed_job/test_postponed_job.rb#L1 # frozen_string_literal: false require 'test/unit' -require 'thread' require '-test-/postponed_job' module Bug Index: test/lib/test/unit.rb =================================================================== --- test/lib/test/unit.rb (revision 60138) +++ test/lib/test/unit.rb (revision 60139) @@ -452,8 +452,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L452 return end - # Require needed things for parallel running - require 'thread' + # Require needed thing for parallel running require 'timeout' @tasks = @files.dup # Array of filenames. @need_quit = false Index: test/bigdecimal/test_bigdecimal.rb =================================================================== --- test/bigdecimal/test_bigdecimal.rb (revision 60138) +++ test/bigdecimal/test_bigdecimal.rb (revision 60139) @@ -2,8 +2,6 @@ https://github.com/ruby/ruby/blob/trunk/test/bigdecimal/test_bigdecimal.rb#L2 require_relative "testbase" require 'bigdecimal/math' -require 'thread' - class TestBigDecimal < Test::Unit::TestCase include TestBigDecimalBase Index: test/ruby/test_file.rb =================================================================== --- test/ruby/test_file.rb (revision 60138) +++ test/ruby/test_file.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file.rb#L1 # frozen_string_literal: false require 'test/unit' require 'tempfile' -require "thread" require "-test-/file" require_relative 'ut_eof' Index: test/ruby/test_backtrace.rb =================================================================== --- test/ruby/test_backtrace.rb (revision 60138) +++ test/ruby/test_backtrace.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L1 # frozen_string_literal: false require 'test/unit' -require 'thread' require 'tempfile' class TestBacktrace < Test::Unit::TestCase Index: test/ruby/test_threadgroup.rb =================================================================== --- test/ruby/test_threadgroup.rb (revision 60138) +++ test/ruby/test_threadgroup.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_threadgroup.rb#L1 # frozen_string_literal: false require 'test/unit' -require 'thread' class TestThreadGroup < Test::Unit::TestCase def test_thread_init Index: test/ruby/test_autoload.rb =================================================================== --- test/ruby/test_autoload.rb (revision 60138) +++ test/ruby/test_autoload.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_autoload.rb#L1 # frozen_string_literal: false require 'test/unit' require 'tempfile' -require 'thread' class TestAutoload < Test::Unit::TestCase def test_autoload_so Index: test/ruby/lbtest.rb =================================================================== --- test/ruby/lbtest.rb (revision 60138) +++ test/ruby/lbtest.rb (revision 60139) @@ -1,5 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/lbtest.rb#L1 # frozen_string_literal: false -require 'thread' class LocalBarrier def initialize(n) Index: test/ruby/test_thread.rb =================================================================== --- test/ruby/test_thread.rb (revision 60138) +++ test/ruby/test_thread.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L1 # -*- coding: us-ascii -*- # frozen_string_literal: false require 'test/unit' -require 'thread' class TestThread < Test::Unit::TestCase class Thread < ::Thread @@ -966,7 +965,6 @@ _eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L965 def test_main_thread_status_at_exit assert_in_out_err([], <<-'INPUT', ["false false aborting"], []) -require 'thread' q = Thread::Queue.new Thread.new(Thread.current) {|mth| begin Index: test/monitor/test_monitor.rb =================================================================== --- test/monitor/test_monitor.rb (revision 60138) +++ test/monitor/test_monitor.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/monitor/test_monitor.rb#L1 # frozen_string_literal: false require "monitor" -require "thread" require "test/unit" Index: test/test_tempfile.rb =================================================================== --- test/test_tempfile.rb (revision 60138) +++ test/test_tempfile.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/test_tempfile.rb#L1 # frozen_string_literal: true require 'test/unit' require 'tempfile' -require 'thread' class TestTempfile < Test::Unit::TestCase def initialize(*) Index: test/test_mutex_m.rb =================================================================== --- test/test_mutex_m.rb (revision 60138) +++ test/test_mutex_m.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/test_mutex_m.rb#L1 # frozen_string_literal: false require 'test/unit' -require 'thread' require 'mutex_m' class TestMutexM < Test::Unit::TestCase Index: test/socket/test_unix.rb =================================================================== --- test/socket/test_unix.rb (revision 60138) +++ test/socket/test_unix.rb (revision 60139) @@ -9,7 +9,6 @@ require "test/unit" https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L9 require "tempfile" require "timeout" require "tmpdir" -require "thread" require "io/nonblock" class TestSocket_UNIXSocket < Test::Unit::TestCase Index: lib/tracer.rb =================================================================== --- lib/tracer.rb (revision 60138) +++ lib/tracer.rb (revision 60139) @@ -2,7 +2,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/tracer.rb#L2 #-- # $Release Version: 0.3$ # $Revision: 1.12 $ -require "thread" ## # Outputs a source level execution trace of a Ruby program. Index: lib/monitor.rb =================================================================== --- lib/monitor.rb (revision 60138) +++ lib/monitor.rb (revision 60139) @@ -7,8 +7,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/monitor.rb#L7 # You can freely distribute/modify this library. # -require 'thread' - # # In concurrent programming, a monitor is an object or module intended to be # used safely by more than one thread. The defining characteristic of a Index: lib/rinda/ring.rb =================================================================== --- lib/rinda/ring.rb (revision 60138) +++ lib/rinda/ring.rb (revision 60139) @@ -4,7 +4,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/rinda/ring.rb#L4 # require 'drb/drb' require 'rinda/rinda' -require 'thread' require 'ipaddr' module Rinda Index: lib/rinda/tuplespace.rb =================================================================== --- lib/rinda/tuplespace.rb (revision 60138) +++ lib/rinda/tuplespace.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rinda/tuplespace.rb#L1 # frozen_string_literal: false require 'monitor' -require 'thread' require 'drb/drb' require 'rinda/rinda' require 'forwardable' Index: lib/rinda/rinda.rb =================================================================== --- lib/rinda/rinda.rb (revision 60138) +++ lib/rinda/rinda.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rinda/rinda.rb#L1 # frozen_string_literal: false require 'drb/drb' -require 'thread' ## # A module to implement the Linda distributed computing paradigm in Ruby. Index: lib/singleton.rb =================================================================== --- lib/singleton.rb (revision 60138) +++ lib/singleton.rb (revision 60139) @@ -1,5 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/lib/singleton.rb#L1 # frozen_string_literal: false -require 'thread' # The Singleton module implements the Singleton pattern. # Index: lib/drb/drb.rb =================================================================== --- lib/drb/drb.rb (revision 60138) +++ lib/drb/drb.rb (revision 60139) @@ -47,7 +47,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/drb/drb.rb#L47 # Translation of presentation on Ruby by Masatoshi Seki. require 'socket' -require 'thread' require 'io/wait' require 'drb/eq' Index: lib/drb/extservm.rb =================================================================== --- lib/drb/extservm.rb (revision 60138) +++ lib/drb/extservm.rb (revision 60139) @@ -5,7 +5,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/drb/extservm.rb#L5 =end require 'drb/drb' -require 'thread' require 'monitor' module DRb Index: lib/webrick/httpservlet/filehandler.rb =================================================================== --- lib/webrick/httpservlet/filehandler.rb (revision 60138) +++ lib/webrick/httpservlet/filehandler.rb (revision 60139) @@ -9,7 +9,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpservlet/filehandler.rb#L9 # # $IPR: filehandler.rb,v 1.44 2003/06/07 01:34:51 gotoyuzo Exp $ -require 'thread' require 'time' require 'webrick/htmlutils' Index: lib/webrick/utils.rb =================================================================== --- lib/webrick/utils.rb (revision 60138) +++ lib/webrick/utils.rb (revision 60139) @@ -91,7 +91,6 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/utils.rb#L91 ########### - require "thread" require "timeout" require "singleton" Index: lib/thwait.rb =================================================================== --- lib/thwait.rb (revision 60138) +++ lib/thwait.rb (revision 60139) @@ -5,7 +5,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/thwait.rb#L5 # $Revision: 1.3 $ # by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd.) -require "thread.rb" require "e2mmap.rb" # Index: lib/irb/ext/multi-irb.rb =================================================================== --- lib/irb/ext/multi-irb.rb (revision 60138) +++ lib/irb/ext/multi-irb.rb (revision 60139) @@ -10,7 +10,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/multi-irb.rb#L10 # # IRB.fail CantShiftToMultiIrbMode unless defined?(Thread) -require "thread" module IRB class JobManager Index: lib/shell/command-processor.rb =================================================================== --- lib/shell/command-processor.rb (revision 60138) +++ lib/shell/command-processor.rb (revision 60139) @@ -11,7 +11,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/shell/command-processor.rb#L11 # require "e2mmap" -require "thread" require "shell/error" require "shell/filter" Index: sample/dualstack-httpd.rb =================================================================== --- sample/dualstack-httpd.rb (revision 60138) +++ sample/dualstack-httpd.rb (revision 60139) @@ -3,7 +3,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/dualstack-httpd.rb#L3 # The code demonstrates how a multi-protocol daemon should be written. require "socket" -require "thread" port = 8888 res = Socket.getaddrinfo(nil, port, nil, Socket::SOCK_STREAM, nil, Socket::AI_PASSIVE) Index: sample/drb/dlogd.rb =================================================================== --- sample/drb/dlogd.rb (revision 60138) +++ sample/drb/dlogd.rb (revision 60139) @@ -4,7 +4,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/dlogd.rb#L4 =end require 'drb/drb' -require 'thread' class Logger def initialize(fname) Index: sample/drb/http0serv.rb =================================================================== --- sample/drb/http0serv.rb (revision 60138) +++ sample/drb/http0serv.rb (revision 60139) @@ -1,7 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/http0serv.rb#L1 require 'webrick' require 'drb/drb' require 'drb/http0' -require 'thread' module DRb module HTTP0 Index: sample/drb/simpletuple.rb =================================================================== --- sample/drb/simpletuple.rb (revision 60138) +++ sample/drb/simpletuple.rb (revision 60139) @@ -3,8 +3,6 @@ https://github.com/ruby/ruby/blob/trunk/sample/drb/simpletuple.rb#L3 # Copyright (c) 1999-2000 Masatoshi SEKI # You can redistribute it and/or modify it under the same terms as Ruby. -require 'thread' - class SimpleTupleSpace def initialize @hash = {} Index: sample/observ.rb =================================================================== --- sample/observ.rb (revision 60138) +++ sample/observ.rb (revision 60139) @@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/sample/observ.rb#L1 #! /usr/local/bin/ruby -require "thread" req (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/