On 1/10/08, Elliott Slaughter <elliottslaughter@...> wrote:
> I've been trying to write a non-hanging read function for a project I
> am working on. The code below works except that after the user presses
> a key, SBCL hangs until the user presses enter. In the test loop
> below, the loop runs properly (read-some returns immediately) until
> the user presses a letter, causing the read-some (and thus the loop)
> to hang until the user presses enter.
Are you on Windows by any chance? This works for me as expected on
posixoid platforms, and our Windows implementation for SYSREAD-MAY-BLOCK-P
in src/code/fd-stream.lisp is quite different from all other platforms.
I'm not sure if this can be done on Windows without changing the Console
state, and I'm equally unsure if it's kosher for READ-CHAR-NO-HANG to do
that behind the user's back. (Similarly as we don't frob tcattrs on other
Hm. We seem to be using just ReadFile on Windows. It might be that we should
use ReadConsole in this case.
...but I don't have a Windows development box at the moment, so I cannot
look into this properly. I am happy to merge code from intrepid Windows
Then again, if you are *not* on Windows, output from uname -a would be