On 27.05.2009 18:24, Nabs Kahn wrote:
>> Btw, you do not need a separate producer thread.  You can simply do
>> that in the main thread.  But of course you must start worker threads
>> before you start to fill the queue.
> 
> Oh, I thought it would cause the main thread to pause until there was 
> room in the queue since there would be more urls in the file, but only 
> 10 in the queue, so I created a new thread for the producer thread. 

Well, it will.  But so will your producer thread and eventually the main 
thread since it joins on the producer.  The producer thread brings you 
only advantages if you need to do other things in the main thread.  But 
since you don't in the code you presented you can as well do the queue 
filling in the main thread.

Btw, I just notice one thing: you don't chomp the lines read from the 
file.  So your URL's will still contain the trailing line feed.

> Thanks for the information.

You're welcome!

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/