From: Dossy Date: 2002-05-30T22:13:49+09:00 Subject: Re: Thread id? On 2002.05.30, Morris, Chris wrote: > for page in pages > threads << Thread.new(page) { |myPage| > > h = Net::HTTP.new(myPage, 80) > puts "Fetching: #{myPage}" > resp, data = h.get('/', nil ) > puts "Got #{myPage}: #{resp.message} #{id.to_s}" > } > end > > Why does each thread output the same id value? Because id.to_s is returning you the id of self.id, which is the object creating the threads. If you want the ID of the Thread object, you need to send a message to the thread object: > puts "Got #{myPage}: #{resp.message} #{Thread.current.id.to_s}" HTH, -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)