[Haskell-cafe] System.Process and -threaded
donn at avvanta.com
Sun May 18 06:25:43 UTC 2014
quoth Karsten Gebbert,
>> -- mplayer
>> (hand,o,e,pid) <- runInteractiveProcess "mplayer" ["-fs", "-idle", "-slave"] Nothing Nothing
>> putStrLn "listening for commands"
>> loop sock hand
>> -- closing everything down
>> sClose sock
>> terminateProcess pid
>> waitForProcess pid
>> return ()
In an idle moment I wrote up a simplified test program, and found
something interesting. When compiled with -threaded, the above
code garbage-collects and finalizes "o" -- the child process' output.
That tends to shorten the process life span.
If I build without -threaded, or use "o" during or after the loop,
no problem. Or if I build with -threaded but run with the -V0 flag,
which I suppose would delay garbage collection.
More information about the Haskell-Cafe