This method is deprecated or moved on the latest stable version.
The last existing version (v2_2_9) is shown here.
timeout(seconds, exception=Timeout::Error)
private
Executes the passed block and raises exception if execution takes
more than seconds.
If seconds is zero or nil, simply executes the block
# File lib/webrick/utils.rb, line 218
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