ghci and ghc -threaded broken with pipes & forking
jgoerzen at complete.org
Wed Feb 28 12:15:04 EST 2007
I've been hitting my head against a wall for the past couple of days
trying to figure out why my shell-like pipeline code kept hanging. I
found fd leakage (file descriptors not being closed), which disrupts EOF
detection and can lead to deadlocks. I just couldn't find the problem.
I finally tried compiling my test with ghc instead of running it in
And poof, it worked fine the first time.
I tried asking on #haskell, and got the suggestion that ghci uses
-threaded. I tried compiling my test program with ghc -threaded, and
again, same deadlock. My program never calls forkIO or forkOS or any
other threading code.
You can see my test case with:
darcs get '--tag=glasgow ml' http://darcs.complete.org/hsh
ghc -fglasgow-exts --make -o test2 test2.hs
That'll run fine. If you add -threaded, it will hang.
More information about the Glasgow-haskell-users