[Haskell-cafe] Re: Hugsvs GHC (again)was: Re: Somerandomnewbiequestions

Udo Stenzel u.stenzel at web.de
Fri Jan 21 03:41:56 EST 2005

Ben Rudiak-Gould <Benjamin.Rudiak-Gould at cl.cam.ac.uk> schrieb am 21.01.05 02:37:34:

> If you're reading from a random-access file, there's no way [select] can tell 
> you when the file data is buffered, because it doesn't know which part 
> of the file you plan to read. The OS may try to guess for readahead 
> purposes, but select()'s behavior can't depend on that guess.

The Glibc documentation says, "select determines if there is data available 
(more precisely, if a call to read(2) will not block)."  I think, this is reasonably
precise.  The OS does know, where you are going to read (at the file pointer)
and if you seek() or pread() instead, well, that is no call to read(2) and may
change everything.

Thus the question is, does select() reliably tell if read() would block or does it
check for something else?  Is the documentation wrong (on some platforms)?

> This is another example of why the world would be better off with the 
> file/stream model. Have I convinced anyone?

Uhm, well, me thinks, open() and read() on files quite accurately model a stream


Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201

More information about the Haskell-Cafe mailing list