module

Timeout

v1_8_6_287 - Show latest stable

Description

A way of performing a potentially long-running operation in a thread, and terminating it’s execution if it hasn’t finished within fixed amount of time.

Previous versions of timeout didn’t use a module for namespace. This version provides both Timeout.timeout, and a backwards-compatible #timeout.

Synopsis

  require 'timeout'
  status = Timeout::timeout(5) {
    # Something that should be interrupted if it takes too much time...
  }

Constants

CALLER_OFFSET = ((c = caller[0]) && THIS_FILE =~ c) ? 1 : 0

THIS_FILE = /\\A#{Regexp.quote(__FILE__)}:/o

Files

  • lib/timeout.rb

Nested classes and modules