From: Jan Svitok Date: 2006-07-29T21:53:51+09:00 Subject: Re: ruby threads? the point? On 7/29/06, Eric Armstrong wrote: > So how would you implement a simple keyboard-controller > for threads on Windows? Maybe you can use kbhit() and getch() from msvcrt.dll kbhit returns whether there are any keystrokes in the buffer getc returns them. So, what I do is (or something similar, I don't have the exact code here): kbhit = Win32API.new('msvcrt','kbhit',...) getch = ... def wait_for_keypress while true if kbhit.Call ch = getch.Call while kbhit.Call # to flush the buffer return end sleep 0.1 # this should allow other threads to run end end J.