From: rubix Rubix Date: 2011-12-21T06:31:47+09:00 Subject: Re: ruby multithread Hi, Thank you for your answer and sorry for the late, I have a queue of url: --------------------------------------- Links =Queue.new Links.push(url1) Links.push(url2) Links.push(url3) # a method to download page def openurl(uri) object_uri = open(url) end def ParseHtml(url) Extract Meta end def CommitPage(page) insert meta to database (Mysql) end def Work(url) openurl(url) ParseHtml(url) CommitPage(page) end t1=Thread.new{work(url1)} t2=Thread.new{work(url2)} t3=Thread.new{work(url3)} t1.join t2.join t3.join ------------------------------------------ The cpu is idle when executing methods openurl, commitpage because they take time accessing data but I notice that when executing this script t2 will wait for t1 until it finishes and t3 for t2 have you a solution for this problem, because I am waisting a big time like this best regards -- Posted via http://www.ruby-forum.com/.