module SystemTimer

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:

Usage

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

Attributes

timer_pool[R]

Public Class Methods

timeout(seconds) click to toggle source

Backward compatibility with timeout.rb

Alias for: timeout_after
timeout_after(seconds) { || ... } click to toggle source
# File lib/system_timer_stub.rb, line 8
def timeout_after(seconds)
  Timeout::timeout(seconds) do
    yield
  end
end
Also aliased as: timeout, timeout

Protected Class Methods

debug(message) click to toggle source
# File lib/system_timer.rb, line 104
def debug(message)    #:nodoc
  puts message if debug_enabled?
end