Timer based on underlying ITIMER_REAL system timer. It is a
solution to Ruby processes which hang beyond the time limit when accessing
external resources. This is useful when timeout.rb, which relies on green
threads, does not work consistently.
For more information and background check out:
require 'systemtimer' SystemTimer.timeout_after(5) do # Something that should be interrupted if it takes too much time... # ... even if blocked on a system call! end
Copyright 2008 David Vollbracht & Philippe Hanrigou
Copyright 2008 David Vollbracht & Philippe Hanrigou
Backward compatibility with timeout.rb
# File lib/system_timer_stub.rb, line 8 def timeout_after(seconds) Timeout::timeout(seconds) do yield end end
# File lib/system_timer.rb, line 104 def debug(message) #:nodoc puts message if debug_enabled? end