vendor/bundle/ruby/2.7.0/gems/ruby-debug-ide-0.7.3/lib/ruby-debug-ide/command.rb
# see Timeout::timeout, the difference is that we must use a DebugThread
# because every other thread would be halted when the event hook is reached
# in ruby-debug.c
see Timeout::timeout, the difference is that we must use a DebugThread
because every other thread would be halted when the event hook is reached
in ruby-debug.c
see Timeout :: timeout the difference is that we must use a DebugThread because every other thread would be halted when the event hook is reached in ruby - debug . c
def timeout(sec)
      return yield if sec == nil or sec.zero?
      if Thread.respond_to?(:critical) and Thread.critical
        raise ThreadError, "timeout within critical session"      
      end
      begin
        x = Thread.current
        y = DebugThread.start {
          sleep sec
          x.raise StandardError, "Timeout: evaluation took longer than #{sec} seconds." if x.alive?
        }
        yield sec
      ensure
        y.kill if y and y.alive?
      end
    end
def timeout ( sec ) return yield if sec == nil or sec . zero? if Thread . respond_to? ( :critical ) and Thread . critical raise ThreadError , "timeout within critical session" end begin x = Thread . current y = DebugThread . start { sleep sec x . raise StandardError , "Timeout: evaluation took longer than #{sec} seconds." if x . alive? } yield sec ensure y . kill if y and y . alive? end end
see Timeout::timeout, the difference is that we must use a DebugThread
because every other thread would be halted when the event hook is reached
in ruby-debug.c
see Timeout :: timeout the difference is that we must use a DebugThread because every other thread would be halted when the event hook is reached in ruby - debug . c
sec