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

David Roundy droundy at darcs.net
Fri Feb 8 15:55:09 EST 2008

On Fri, Feb 08, 2008 at 10:46:25AM +0000, 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 from 
> more than one thread you would need to use atomicallyModifyIORef, or MVars.

If I did modify the IORef from more than one thread (e.g. if a bug were
introduced), would this cause any trouble other than occasional missed
updates or reads of wrong data?
David Roundy
Department of Physics
Oregon State University

More information about the Haskell-Cafe mailing list