[Openmcl-devel] read-char-no-hang can hang

Ron Garret ron at flownet.com
Wed Nov 14 23:55:44 PST 2012


When reading from /dev/some-slow-serial-device, read-char-no-hang can hang.  I think this is because LISTEN is defined to return NIL only on EOF, and the OS doesn't report the absence of input characters as EOF.  I tried to work around this by being devilishly clever and setting the underlying file descriptor to be non-blocking and using the FFI to call read() directly, but that seems to leave Lisp very confused:

? (read-char f)
> Error: Expected newpos to be 3, fd is at 5
> While executing: CCL::IO-FILE-IOBLOCK-ADVANCE, in process Listener(6).

Is there a way to reliably tell whether or not a call to read-char will hang on a serial device stream?

rg




More information about the Openmcl-devel mailing list