Problem calling Net::HTTP.get_response in Thread.new

i had a strange problem of unable to call Net::HTTP.get_response in
thread
example this work well

Net::HTTP.get_response(URI.parse("http://www.google.com/"))

however when i called inside a thread it does not work it does not work,
i was wondering why.

Thread.new do
    Net::HTTP.get_response(URI.parse("http://www.google.com/"))
end

···

--
Posted via http://www.ruby-forum.com/.

Is that your entire program? If so you will need

t = Thread.new do
   # whatever
end
t.join

Otherwise the main program will exit immediately, and terminate all other
threads.

···

On Thu, Apr 12, 2007 at 04:54:05AM +0900, Ming en Chia wrote:

i had a strange problem of unable to call Net::HTTP.get_response in
thread
example this work well

Net::HTTP.get_response(URI.parse("http://www.google.com/"\))

however when i called inside a thread it does not work it does not work,
i was wondering why.

Thread.new do
    Net::HTTP.get_response(URI.parse("http://www.google.com/"\))
end