I need to get user input from console asynchronously, i.e. without blocking. I could use the following Python code to check if there is an input available, but it gives 100% CPU load.
import msvcrt
while not msvcrt.kbhit():
pass
Is there any other way to do this? Is it possible to register a callback function for keyboard events in console, for example?
UPDATE: I've created a working solution in Python / ctypes. See example at http://techtonik.rainforce.org/2011/03/asynchronous-input-from-windows-console.html