[Openmcl-devel] Binary IO...

Gary Byers gb at clozure.com
Tue Jun 9 19:52:20 UTC 2009


If a file stream  is opened with :direction :io, then there's a single
underlying FD that can be used for reading and writing, and STREAM-DEVICE
should return the same value for :INPUT and :OUTPUT.

(A TWO-WAY-STREAM is generally composed of separate input and output streams
that may have underlying FDs that're distinct).

On Tue, 9 Jun 2009, Jon S. Anthony wrote:

>
> This appears to be pretty much exactly what I need.  Since these vectors
> behave like "regular vectors" in normal code, I really don't even need
> the capabilities of WITH-HEAP-IVECTOR (at least I don't now think
> so...).  The only thing left is the ability to have (or simulate) a
> bidirectional stream with this.
>
> So, is it legitimate to do this sort of thing (basically use the same
> stream for reading and writing)?  Or can there be two separate streams
> open at the same time for the same file (one for input, one for output)?
>

I'd assume that reading and writing the same file (via separate streams/fds)
could be problematic; I don't know how much the OS tries to ensure that
the right things happen (e.g., that the reader will always see what
the writer writes, even if readahead and caching mechanisms had prepared
it to see something else.)

I don't know, though, and if I ever knew anything useful about this I've
forgotten it.  If there are issues there, it seems likely that those issues
aren't lisp- or CCL-specific.



More information about the Openmcl-devel mailing list