From: Elliott S. <ell...@gm...> - 2008-01-10 17:27:49
|
On Jan 10, 2008 1:03 AM, Nikodemus Siivola <nik...@ra...> wrote: > On 1/10/08, Elliott Slaughter <ell...@gm...> 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. Yes. And I just confirmed that it works fine under linux. > 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 > platforms.) > > Hm. We seem to be using just ReadFile on Windows. It might be that we should > use ReadConsole in this case. > > http://msdn2.microsoft.com/en-us/library/ms684958(VS.85).aspx > > ...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 > hackers, however. I don't really know enough about windows specific programming to help you... I just happened to be running my code on windows at the time. But I would be happy to test anything you come up with. -- Elliott Slaughter "Any road followed precisely to its end leads precisely nowhere." - Frank Herbert |