[gambit-list] I/O Question
francisco.listas at gmail.com
Thu May 1 19:21:02 EDT 2008
Marc Feeley wrote:
> On 1-May-08, at 5:50 PM, Francisco wrote:
>> (define (with-string-stop str c)
>> ((port (open-string str)))
>> (read-string-until-char port c)))
> "open-string" creates an input-output-port, that is a port you can
> write to and read from. Whatever you write to it becomes readable (in
> other words it is a FIFO). So the system cannot tell when the stream
> is at "end-of-file" because in principle some thread might have a
> reference to the port and at some point in the future add something to
> the FIFO. However, the scheduler sees that no other thread is
> runnable when the read-char is called on an empty FIFO, so it declares
> that there is a deadlock (no further progress is possible).
> So change the open-string by open-input-string (which creates an
> input-(only)-port) and the end-of-file will be read by read-char as
> you expect it.
Oh thank you! And what about if want to do it on a network socket, I
want to parse the input until a char is found, or until the end of the
available input, but according to that input I need to respond using the
How do I do that?
More information about the Gambit-list