From: Robert Klemme Date: 2010-01-22T17:20:25+09:00 Subject: Re: thread example 2010/1/22 Jacob Mitchell : > On Thu, Jan 21, 2010 at 10:53 PM, Ruby Newbee wrote: > >> After I run it, I didn's see any output, even the expected puts: >> "I counted up to #{@count} before I was cruelly stopped." >> >> Where is wrong? >> Thanks. >> >> > The output is getting buffered so it's just not getting displayed before the > thread stops.  To fix this, put "$stdout.flush" at the end of your code. I would rather add "counter.join" at the end because otherwise process may exit before the thread had time to generate the output. In that case sync = true does not help much. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/