Last Modified
2014-11-08 11:08:02 -0700



execution timeout


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


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.



(C) 2000 Network Applied Communication Laboratory, Inc.


(C) 2000 Information-technology Promotion Agency, Japan

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit

blog comments powered by Disqus