Project

General

Profile

Bug #4289 » 0001-timeout.rb-avoid-introducing-new-class-for-every-tim.patch

normalperson (Eric Wong), 04/06/2011 07:36 AM

View differences:

lib/timeout.rb
# so you can call it directly as Timeout.timeout().
def timeout(sec, klass = nil) #:yield: +sec+
return yield(sec) if sec == nil or sec.zero?
exception = klass || Class.new(ExitException)
exception = klass || ExitException
begin
x = Thread.current
y = Thread.start {
(1-1/7)