Class: Evdispatch::Loop

Inherits:
Object
  • Object
show all
Defined in:
ext/revdispatch/test.rb,
lib/evdispatch/loop.rb,
ext/revdispatch/revdispatch.cc

Overview

NOTE: we define this part in ruby to make sure other ruby threads can execute while we wait

Instance Method Summary collapse

Instance Method Details

#response(id, timeout = 2.0) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/evdispatch/loop.rb', line 7

def response(id, timeout = 1.0)
  timer = Time.now
  while wait_for_response( id, 1, 0 )
    res = response_for( id )
    break if res
    break if( (Time.now - timer) > timeout )
  end
  res = response_for( id ) unless res
  res
end