Created
October 9, 2010 22:58
-
-
Save brainopia/618701 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'em-synchrony' | |
require 'em-synchrony/em-http' | |
require 'em-synchrony/iterator' | |
=begin | |
Currently Synchrony::Iterator does not support synced calls inside, | |
but it can by integrating fiber pool inside. | |
It even makes more sense for concurrency option of Iterator to be fiber pool size. | |
=end | |
EM.run do | |
urls = Array.new(5, 'http://ya.ru') | |
EM::Synchrony::Iterator.new(urls, 5).each do | |
# currently fails with "yield from root fiber" | |
EM::HttpRequest.new(url).get # or any other synced evented call | |
puts '+1' | |
end | |
EM.stop | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment