[Haskell-cafe] Re: threads + IORefs = Segmentation fault?

2008-02-14 Thread Simon Marlow
David Roundy wrote: Yes, that should all be fine, because the IORef is only modified from one thread, and read from the other(s). If you were modifying the IORef from more than one thread you would need to use atomicallyModifyIORef, or MVars. If I did modify the IORef from more than one

[Haskell-cafe] Re: threads + IORefs = Segmentation fault?

2008-02-08 Thread Simon Marlow
David Roundy wrote: I'm working on some new progress-reporting code for darcs, and am getting segmentation faults! :( The code uses threads + an IORef global variable to do this (with lots of unsafePerformIO). So my question for the gurus who know more about this than I do: is this safe? I

Re: [Haskell-cafe] Re: threads + IORefs = Segmentation fault?

2008-02-08 Thread David Roundy
On Fri, Feb 08, 2008 at 10:46:25AM +, Simon Marlow wrote: (I'm a bit behind with haskell-cafe, sorry for not seeing this sooner...) No problem! Yes, that should all be fine, because the IORef is only modified from one thread, and read from the other(s). If you were modifying the IORef

[Haskell-cafe] Re: threads + IORefs = Segmentation fault?

2008-01-19 Thread Achim Schneider
David Roundy [EMAIL PROTECTED] wrote: {-# NOINLINE _progressData #-} _progressData :: IORef (Map String ProgressData) _progressData = unsafePerformIO $ newIORef empty updateProgressData :: String - (ProgressData - ProgressData) - IO () updateProgressData k f = when