[Haskell-cafe] runInteractiveCommand: program ends before writing
or reading all the output
Olivier Boudry
olivier.boudry at gmail.com
Thu May 15 15:06:19 EDT 2008
On Thu, May 15, 2008 at 2:42 PM, Ronald Guida <oddron at gmail.com> wrote:
> It looks like a simple race condition to me. You are using
> "waitForProcess pid" to wait for runInteractiveCommand to finish, but
> you don't seem to have anything that waits for createDefFile to
> finish.
>
Thanks Ronald,
As I could not find a function to wait on a ThreadId I used a MVar to
synchronize both threads.
> sync <- newEmptyMVar
> forkIO (createDefFile sync file out)
> waitForProcess pid
> takeMVar sync
and at the end of the forked thread:
> putMVar sync ()
Is this normal or have I missed the `waitOnThreadId` function?
Thanks for all the comments received on this thread,
Olivier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080515/55036527/attachment.htm
More information about the Haskell-Cafe
mailing list