From: Miguel Angel Nieto Date: 2011-07-29T05:39:35+09:00 Subject: Re: long loops inside threads 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 -- Posted via http://www.ruby-forum.com/.