
6 Apr
2007
6 Apr
'07
3:44 p.m.
Ooops! It seems that this doesn't behave well with a -threaded RTS. I get an EOF on handles that I know for a fact shouldn't be receiving them. It still works well without -threaded, but does anyone know why I'm getting this behavior? hGetContentsTimeout :: Handle -> Int -> IO String hGetContentsTimeout h t = do hSetBuffering stdin NoBuffering ready <- hWaitForInput h t if (not ready) then return [] else do c <- hGetChar h s <- unsafeInterleaveIO (hGetContentsTimeout h t) return (c:s) (I did add EOF checking, but all that did was return the end of the list earlier than I wanted)