Flowdock
v1_9_3_125 - Show latest stable - 0 notes - Superclass: Object

Class used to manage timeout handlers across multiple threads.

Timeout handlers should be managed by using the class methods which are synchronized.

id = TimeoutHandler.register(10, Timeout::Error)
begin
  sleep 20
  puts 'foo'
ensure
  TimeoutHandler.cancel(id)
end

will raise Timeout::Error

id = TimeoutHandler.register(10, Timeout::Error)
begin
  sleep 5
  puts 'foo'
ensure
  TimeoutHandler.cancel(id)
end

will print ‘foo’

Constants

TimeoutMutex = Mutex.new # :nodoc:

Attributes

Show files where this class is defined (1 file)
Register or log in to add new notes.