Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Problem calling Net::HTTP.get_response in Thread.new
Ming en Chia
4/11/2007 7:54:00 PM
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....
))
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....
))
end
--
Posted via
http://www.ruby-...
.
1 Answer
Brian Candler
4/11/2007 8:12:00 PM
0
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....
))
>
> 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....
))
> end
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.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Problem calling Net::HTTP.get_response in Thread.new
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password