Flowdock

timeout.rb

execution timeout

Synopsis

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

Description

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

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

Copyright

Copyright

(C) 2000 Network Applied Communication Laboratory, Inc.

Copyright

(C) 2000 Information-technology Promotion Agency, Japan

Constants

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

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

Attributes

Show files where this module is defined (1 file)
Register or log in to add new notes.