From: Jan Svitok Date: 2006-10-24T01:25:51+09:00 Subject: Re: Trouble using puts and getc in different threads On 10/23/06, Mark wrote: > On 10/23/06, Francis Cianfrocca wrote: > > Try it on a Unix-like system. It will work. We've had several discussions > > here about an bad interaction between Ruby threads and system I/O on > > Windows, but I'm not sure anyone has gotten to the bottom of it. > > Hmm, that was not the answer I was hoping for... And I don't have the > luxury of using a linux computer. :-( > > Does this mean that is not possible to write a ruby program that > continuously outputs data on stdout until a key is pressed by the > user? It sounds so simple. > > I found a posting from Nobu Nokada in 2002 saying "Another problem due > to select(), thread cannot switch while console input." which > explaines my code doesn't work. Must I draw the conclusion that this > problem still isn't fixed? if you're on windows, see [1] thread for a solution, especially [2] (using kbhit()) and [3] (using select) [1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/204589 [2] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/204863 [3] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/205002