IO question (hGetLine)

Gerd M gerd_m1977 at hotmail.com
Mon Jun 14 11:57:51 EDT 2004


Duncan Coutts wrote:
>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?
I'm using ghc-6.2.1 to compile in 32bit mode while i'm running the program 
in 64bit (Linux Kernel 2.6.5, amd64) with the 32bit emulation libraries. I 
don't think that is the problem spot because all other 32bit application are 
working fine.

mainLoop dev = do inp <- hGetLine dev
                             (runIndexCmd . parseInput) inp
                             return ()

This is called from main with:
            devHandle    <- openFile device ReadMode
            ...................
            catchJust asyncExceptions
                      (forever (mainLoop devHandle))
                      (cleanup devHandle)

forever = a >> forever a

The module that manages the device puts a process to sleep with 
interruptible_sleep_on( queue ) if there's no data available and wakes it up 
as soon as input arrives. As i said before this works when i use "cat".

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus



More information about the Glasgow-haskell-users mailing list