Sha256: 46a833872605723d563e7b55077bf8edbbdfda7586391518fb9a818428a1041c

Contents?: true

Size: 443 Bytes

Versions: 8

Compression:

Stored size: 443 Bytes

Contents

require 'revdispatch'

# define this part in ruby to make sure other
# ruby threads can execute while we waiting for a response
module Evdispatch
  class Loop
    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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
evdispatch-0.3.1 lib/evdispatch/loop.rb
evdispatch-0.2.4 lib/evdispatch/loop.rb
evdispatch-0.2.5 lib/evdispatch/loop.rb
evdispatch-0.2.6 lib/evdispatch/loop.rb
evdispatch-0.3.0 lib/evdispatch/loop.rb
evdispatch-0.4.1 lib/evdispatch/loop.rb
evdispatch-0.4.0 lib/evdispatch/loop.rb
evdispatch-0.4.2 lib/evdispatch/loop.rb