From: Robert Klemme Date: 2005-11-04T18:12:08+09:00 Subject: Re: Continous running thread Bob Showalter wrote: > iamscottwalter@gmail.com wrote: >> Hi, >> >> I have a simple task, I want to have a Thread that will every 2 >> minutes perfom a task. I have tried: >> >> thread = Thread.new do >> while true >> puts "Scott" >> sleep 10000 >> end >> end >> >> But it seems to only print "scott" once. How can I in Ruby have a >> thread that will puts "scott" ervery 10 seconds? > > You have to join the thread, or otherwise ensure the process keeps > running. Also 10000 is 10 thousand seconds, or 2-3/4 hours. Yes joining is the main problem here. But if Bob makes his main thread join this thread he doesn't need another thread at all. :-) Kind regards robert