[Haskell-cafe] Re: haskell and releasing resources

Simon Marlow simonmarhaskell at gmail.com
Wed Feb 7 11:38:22 EST 2007

Joachim Breitner wrote:
> Hi,
> Am Mittwoch, den 07.02.2007, 11:05 +1100 schrieb Donald Bruce Stewart:
>>> Am Dienstag, den 06.02.2007, 15:56 +0100 schrieb Fawzi Mohamed:
>>>> I am replying to myself, but anyway with it seems (from the  
>>>> documentation) that
>>>>      forkIO (do{ waitForProcess pid; return () })
>>>> is the best solution, and does not seem to lead to wasted resources.
>>> This does not work for me. According to strace, the spawned process is
>>> in a blocking write, the haskell process is in a blocking waitpid, and I
>>> am sure that the program would consume all output.
>> Any difference with -threaded ?
> Yes: Then it works. Strangely it also depends on which machine the same
> binary runs: On my desktop, it works even without threaded, but on the
> server it hangs.
> Are there any disadvantages of -threaded? Zombie processes are not too
> bad, after all.

Probably not, for most uses.  Perhaps the only remaining use for the 
non-threaded runtime is a multithreaded program that needs to call into a 
non-thread-safe foreign library (this is the issue affecting Gtk).

It's possible that for 6.8 we could make -threaded the default; it's already 
what you get when you run under GHCi.


More information about the Haskell-Cafe mailing list