method

timeout

Importance_0
v1_9_1_378 - Show latest stable - 0 notes - Class: WEBrick::Utils
timeout(seconds, exception=Timeout::Error) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/webrick/utils.rb, line 163
    def timeout(seconds, exception=Timeout::Error)
      return yield if seconds.nil? or seconds.zero?
      # raise ThreadError, "timeout within critical session" if Thread.critical
      id = TimeoutHandler.register(seconds, exception)
      begin
        yield(seconds)
      ensure
        TimeoutHandler.cancel(id)
      end
    end
Register or log in to add new notes.