Class: WEBrick::Utils::TimeoutHandler
- Inherits:
-
Object
- Object
- WEBrick::Utils::TimeoutHandler
- Defined in:
- uu_os_connection-2.2.4/lib/uu/os/util/embedded_http_server.rb
Instance Method Summary (collapse)
-
- (TimeoutHandler) initialize
constructor
A new instance of TimeoutHandler.
Constructor Details
- (TimeoutHandler) initialize
Returns a new instance of TimeoutHandler
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'uu_os_connection-2.2.4/lib/uu/os/util/embedded_http_server.rb', line 129 def initialize @timeout_info = Hash.new Thread.start{ while true now = Time.now # Original implementation contains # @timeout_info.each{... # which causes problems because hash # cannot be extended wile iterating # over it. @timeout_info.keys.each{|thread| ary = @timeout_info[thread] next unless ary ary.dup.each{|info| time, exception = *info time ||= Time.now interrupt(thread, info.object_id, exception) if time < now } } sleep 0.5 end } end |