want the relationshiop between EM-Synchrony 、em-http-request and fiber 's?
i want to concurrency download web pages so i found these libs,
开发者_运维问答but i can't distinguish the relationship between em-synchrony and em-http-request?
i had checkout the github of each repository,but it seems all example is about eachself,
but from some article,it seems em-synchrony and em-http-request can use together,but i didn't found relevent code
how to write this demo code ,thanks
EM-Synchrony contains the code to make EM-HTTP-Request use fibers. It's in https://github.com/igrigorik/em-synchrony/blob/master/lib/em-synchrony/em-http.rb. So, once you've required em-synchrony/em-http
you're em-http-request calls will be using fibers unless you call the a* versions that get created.
So, something along the lines of:
require 'rubygems'
require 'em-synchrony'
require 'em-synchrony/em-http'
EM.synchrony do
req = EM::HttpRequest.new('http://www.google.com').get
p req
end
精彩评论