From: Tony Arcieri Date: 2010-05-18T13:19:18+09:00 Subject: Re: Asynchronous HTTP request --000e0cdf1bdef1b0da0486d6a4d8 Content-Type: text/plain; charset=ISO-8859-1 On Thu, May 13, 2010 at 1:37 AM, Daniel DeLorme wrote: > Does anyone know how to do the following, but without threads, purely with > asynchronous IO? > > website = Thread.new{ Net::HTTP.get(URI.parse(url)) } > template = compute_lots_of_stuff() > puts template.sub("", website.value) > Looks like you want futures, which can be provided by any number of frameworks. A pretty awesome one to consider is dataflow, which is based off ideas from the Oz language: http://github.com/larrytheliquid/dataflow MenTaLguY's Omnibus library also provides futures, however I don't believe it's presently maintained: http://rubyforge.org/projects/concurrent -- Tony Arcieri Medioh! A Kudelski Brand --000e0cdf1bdef1b0da0486d6a4d8--