diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb index e4902d0..64a40ae 100644 --- a/lib/webrick/utils.rb +++ b/lib/webrick/utils.rb @@ -87,7 +87,6 @@ def random_string(len) ########### require "timeout" - require "singleton" ## # Class used to manage timeout handlers across multiple threads. @@ -116,8 +115,6 @@ def random_string(len) # will print 'foo' # class TimeoutHandler - include Singleton - ## # Mutex used to synchronize access across threads TimeoutMutex = Thread::Mutex.new # :nodoc: @@ -142,6 +139,11 @@ def self.terminate instance.terminate end + def self.instance + @instance ||= new + end + private_class_method :new + ## # Creates a new TimeoutHandler. You should use ::register and ::cancel # instead of creating the timeout handler directly.