From: Luis Parravicini Date: 2007-08-16T20:57:07+09:00 Subject: Re: Threads and loops On 8/16/07, Emil Sandin wrote: > Hi, if I run this script: > > loop{ > puts "hello" > sleep 1 > } > > It outputs "hello" every second. > But if I place it in a separate thread: > > Thread.new do > loop{ > puts "hello" > sleep 1 > } > end > > > > it prints it only one time and then exits. > Why is that? When your program exits, the thread dies. Take a look at Thread.join http://www.ruby-doc.org/core/classes/Thread.html#M000474 -- Luis Parravicini http://ktulu.com.ar/blog/