<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthew Flatt wrote at 04/15/2008 07:51 AM:
<blockquote cite="mid:20080415115128.74031650091@mail-svr1.cs.utah.edu"
type="cite">
<pre wrap="">At Tue, 15 Apr 2008 03:38:07 -0400, Neil Van Dyke wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Incidentally, in some experimenting just now, it seems the "sync" of PLT
372 and 3.99.0.16 has the expected blocking behavior on a FIFO up until
the first EOF, but subsequently does not block on the FIFO. If multiple
input segments are supported, should this EOF behavior in "sync" be changed?
</pre>
</blockquote>
<pre wrap=""><!---->
I'm not suite sure what you mean. Can you provide an example?</pre>
</blockquote>
If I do these three things:<br>
<br>
1. Shell command: mkfifo /tmp/my-fifo<br>
<br>
2. Start this in MzScheme 372:<br>
<br>
(let ((in (open-input-file "/tmp/my-fifo")))<br>
(let loop () <br>
(sync in)<br>
(printf "hit ~S\n" (read-byte in))<br>
(loop)))<br>
<br>
3. Shell command: echo 123 > /tmp/my-fifo<br>
<br>
Then the output from the MzScheme process will be:<br>
<br>
hit 49<br>
hit 50<br>
hit 51<br>
hit 10<br>
hit #<eof><br>
hit #<eof><br>
hit #<eof><br>
hit #<eof><br>
hit #<eof><br>
hit #<eof><br>
[...]<br>
<br>
Given the discussion yesterday, I'd expect "sync" to block after
printing the first "hit #<eof>", until I wrote more input to the
FIFO, but it no longer blocks after the first EOF.<br>
<br>
I also see the same behavior when using "cat" to write incrementally to
the FIFO -- "sync" blocks as expected, until "cat" exits, then "sync"
no longer blocks.<br>
<br>
</body>
</html>