timeout.rb

Path: lib/timeout.rb
Last Update: Tue Mar 13 02:07:05 -0500 2007

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

TimeoutError = Timeout::Error # :nodoc:   Another name for Timeout::Error, defined for backwards compatibility with earlier versions of timeout.rb.

[Validate]

ruby-doc.org is hosted and run by James Britt and Rising Tide Software, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.