
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? Thanks in advance! Gerd _________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail

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
participants (2)
-
Duncan Coutts
-
Gerd M