[Haskell-cafe] Profiling and Threading: never the twain shall meet

Albert Y. C. Lai trebla at vex.net
Thu Jul 5 15:04:18 EDT 2007


Dougal Stanton wrote:
>> do
>>   (hin, hout, herr, ph) <- runInteractiveProcess cmd args Nothing Nothing
>>   forkIO $ hPutStr hin content >> hClose hin
>>   out <- hGetContents hout
>>   return (ph, out)
> 
> which seems to require threading. If I compile without, it will hang
> indefinitely, I presume deadlocked. Is there a way this can be done
> without threading?

With much sweat, you could write your own timed polling loop and avoid 
threads, using hPutBufNonBlocking and hGetBufNonBlocking. I don't 
recommend it, except for fun or self-torture.


More information about the Haskell-Cafe mailing list