From: "Carlos J. Hernandez" Date: 2008-01-16T01:41:26+09:00 Subject: Re: Generic ? regarding Threads I did some very minor experimentation back when the first Database library came out for Ruby, so probably this is as far as I can go on this. When you create a thread thread1 = Thread.new { your query #1 here } thread2 = Thread.new { your query #2 here } You can set up a timeout block waiting for thread1 and thread2 to join the main thread. You can use the Timeout library. Looks like it be something like begin Timeout::timeout( @timeout ) do thread1.join; thread2.join end rescue Timeout:ERROR tread1.kill; thread2.kill; end I've not tested the code above, but definitely doable in Ruby. -Carlos On Wed, 16 Jan 2008 00:34:21 +0900, "Venks" said: > I have much simpler requirements. I don't use Active Record which I > believe is not thread safe. I will be using the native MySQL driver > and also there are no DML, just queries. But the important thing is > that I need to pass a time out parameter based on which I need to kill > the all the threads if the entire process exceeds the time out > parameter.