[Haskell-cafe] How can I avoid buffered reads?

Bas van Dijk v.dijk.bas at gmail.com
Mon Dec 10 00:01:31 CET 2012


On 9 December 2012 10:29, Leon Smith <leon.p.smith at gmail.com> wrote:
> On Thu, Dec 6, 2012 at 5:23 PM, Brandon Allbery <allbery.b at gmail.com> wro\
>>
>> Both should be cdevs, not files, so they do not go through the normal
>> filesystem I/O pathway in the kernel and should support select()/poll().
>> ("ls -l", the first character should be "c" instead of "-" indicating
>> character-mode device nodes.)  If ghc is not detecting that, then *that* is
>> indeed an I/O manager issue.
>
>
> The issue here is that if you look at the source of fdReadBuf,  you see that
> it's a plain system call without any reference to GHC's (relatively new) IO
> manager.

What if you use threadWaitRead on the fd before you read from it?

http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent.html#v:threadWaitRead

Bas



More information about the Haskell-Cafe mailing list