Method: Evt::Bundled#next_timeout

Defined in:
lib/evt/backends/bundled.rb

#next_timeoutObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/evt/backends/bundled.rb', line 25

def next_timeout
  _fiber, timeout = @waiting.min_by{ |key, value| value }

  if timeout
    offset = (timeout - current_time) * 1000 # Use mililisecond
    return 0 if offset < 0
    return offset if offset < MAXIMUM_TIMEOUT
  end

  MAXIMUM_TIMEOUT
end