Robert Klemme wrote: >> It creates the thread properly, but when the sleep expires and it is >> ready to call stdin.puts(), it cannot do anything, because the loop >> continued around and it is reading from stderr. > > That can't normally be, because the thread runs independently of the > loop. He's right, and I have replicated the problem. It occurs with with 1.8.6 one-click installer under Windows. With this interpreter, threads are borked: when one thread is waiting on I/O, it prevents all other threads from running. The "official" 1.8.7 Windows build is OK, and so is a cygwin 1.8.7. You can replicate the problem with this: --------------------------------------- Thread.new do while line = $stdin.gets $stderr.puts ">>> Received #{line.chomp} <<<" end end i = -2 loop do $stderr.puts i i += 1 sleep 2 end --------------------------------------- Under the one-click installer 1.8.6, the printing loop freezes until you give it some input. -- Posted via http://www.ruby-forum.com/.