From: Sam Duncan Date: 2011-07-29T05:47:59+09:00 Subject: Re: long loops inside threads No worries. You are on the doorstep of an exciting and endlessly frustrating world. Have fun =] Sam On 29/07/11 08:39, Miguel Angel Nieto wrote: > Hi, > > That was the problem! I have to reread the threat chapter of the ruby > book ;) > > Thank you. > > Sam Duncan wrote in post #1013619: >> Are you join'ing the thread? If not your main thread is likely to exit >> before the counting thread has. >> >> > cat /tmp/test.rb >> require 'thread' >> >> t = Thread.new { >> count=0 >> while count< 10000 do >> puts "x" >> count +=1 >> end >> } >> t.join >> >> >> > ruby /tmp/test.rb |wc -l >> 10000 >> >> > ruby /tmp/test.rb |wc -l >> 10000 >> >> > ruby /tmp/test.rb |wc -l >> 10000 >> >> >> Sam