IO question (hGetLine)
Duncan Coutts
duncan.coutts at worcester.oxford.ac.uk
Sun Jun 13 21:59:14 EDT 2004
On Sun, 2004-06-13 at 23:41, Gerd M wrote:
> I've written a Haskell program that reads continuously from a character
> device that provides data line by line and blocks the reader when there's no
> data available yet.
> At the moment performance isn't a real issue so I thought I would give
> hGetLine a try. Unfortunately the program is consuming a lot of cpu power
> when the input is blocked which is definitely an issue of hGetLine because
> this wasn't the case when I tested it with
> # cat /dev/chardev
> which waits silently until data is available.
> Any suggestions?
The GHC run time system is designed to block without using CPU when all
threads are blocked doing IO.
Could you give more details? It would be useful to see the code or
preferably a small test case that demonstrates your problem. What
version of ghc are you using? Which OS are you running that on?
Duncan
More information about the Glasgow-haskell-users
mailing list