[Haskell-cafe] Re: getChar + System.Cmd.system + threads causes hangups

2006-02-22 Thread Simon Marlow
Donn Cave wrote: On Tue, 21 Feb 2006, Simon Marlow wrote: The reason for the deadlock is because getChar is holding a lock on stdin, and System.Cmd.system needs to access the stdin Handle in order to know which file descriptor to dup as stdin in the child process (the stdin Handle isn't

[Haskell-cafe] Re: getChar + System.Cmd.system + threads causes hangups

2006-02-21 Thread Simon Marlow
Einar Karttunen wrote: Hello Using system or any variant of it from System.Process seems broken in multithreaded environments. This example will fail with and without -threaded. When run the program will print hello: start and then freeze. After pressing enter (the first getChar)

Re: [Haskell-cafe] Re: getChar + System.Cmd.system + threads causes hangups

2006-02-21 Thread Donn Cave
On Tue, 21 Feb 2006, Simon Marlow wrote: ... The reason for the deadlock is because getChar is holding a lock on stdin, and System.Cmd.system needs to access the stdin Handle in order to know which file descriptor to dup as stdin in the child process (the stdin Handle isn't always FD 0,