class

WEBrick::Utils::TimeoutHandler

v2_1_10 - Show latest stable - Superclass: Object

Class used to manage timeout handlers across multiple threads.

Timeout handlers should be managed by using the class methods which are synchronized.

id = TimeoutHandler.register(10, Timeout::Error)
begin
  sleep 20
  puts 'foo'
ensure
  TimeoutHandler.cancel(id)
end

will raise Timeout::Error

id = TimeoutHandler.register(10, Timeout::Error)
begin
  sleep 5
  puts 'foo'
ensure
  TimeoutHandler.cancel(id)
end

will print ‘foo’

Included modules

  • Singleton

Constants

TimeoutMutex = Mutex.new # :nodoc:

Files

  • lib/webrick/utils.rb