[Ecls-list] streams, FILE *s and flisten()

Juan Jose Garcia Ripoll lisp at arrakis.es
Thu May 18 01:36:09 UTC 2006


On Thu, 2006-05-18 at 10:18 +0900, Brian Spilsbury wrote:
> flisten() works by bypassing the FILE * and looking at the underlying
> file descriptor/handle/etc, but this ignores anything that may be
> buffered, so it's possible for flisten() to report that nothing is
> readable without hang, when it is available.

This is not entirely true. flisten() checks the buffer of the FILE
structure whenever possible. This is done at least in linux, *bsd and
possibly other ports.

> More generally, the lack of non-blocking io with FILE *s may cause
> problems for future coroutine or cooperative task based IO, etc.

Hmm, could you elaborate a little bit more on this? Streams provide
atomic read/write operations even in multithreaded environments.

> So my question is: Is there significant value in using FILE * based io
> rather than directly using file descriptors/handles/etc?

Streams are rather portable, they provide buffering, they are available
everywhere and the code was already there. Code reusing is a nice thing,
specially if you want to keep ECL small. Besides that, ANSI CL does not
provide non-blocking read/write operations.

> If there isn't, then I'll have a look at rewriting the io code that
> way, at least for the posix targets.

Please keep us informed of progress.

Juanjo

-- 
Max-Planck-Institut für Quantenoptik
Hans-Kopfermann-Str. 1, Garching, D-85748, Germany
Phone: +49 89 32905 345   Fax: +49 89 32905 336
http://www.mpq.mpg.de/Theorygroup/CIRAC/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20060518/bfa602c3/attachment.sig>


More information about the ecl-devel mailing list