Timeout (library)

From RubySpec

Jump to: navigation, search

The timeout library, provided by timeout.rb in the standard distribution, is used to ensure a long-running operation does not exceed a prespecified timeout. It is an example of threading in Ruby, since a thread is spawned for each operation one wishes to time out.

This library is perhaps most notably used by the net/protocol library, which is in turn used by the frequently-used net/http library. net/protocol uses timeout to prevent perpetual blocking or slow failures when reading each packet of information from a given stream.

Personal tools