Module SystemTimer
In: lib/system_timer/concurrent_timer_pool.rb
lib/system_timer/thread_timer.rb
lib/system_timer.rb
lib/system_timer_stub.rb

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

Methods

Classes and Modules

Class SystemTimer::ConcurrentTimerPool
Class SystemTimer::ThreadTimer

External Aliases

timeout_after -> timeout
  Backward compatibility with timeout.rb
timeout_after -> timeout
  Backward compatibility with timeout.rb

Attributes

timer_pool  [R] 

Public Class methods

Executes the method‘s block. If the block execution terminates before seconds seconds has passed, it returns true. If not, it terminates the execution and raises a +Timeout::Error+.

Protected Class methods

[Validate]