[Haskell-cafe] atomicity and visibility of readIORef / writeIORef

David Kraeutmann kane at kane.cx
Sun Aug 2 12:34:13 UTC 2015


Check
https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-IORef.html:
"An atomicModifyIORef is never observed to take place ahead of any
earlier (in program order) IORef operations, or after any later IORef
operations."
There are atomic variants of write/modifyIORef which place an
appropriate memory barrier so that race conditions (like in the example
on the bottom of the page) can't happen.

On 8/2/2015 2:09 PM, Alexey Egorov wrote:
> Hello haskellers,
> 
> is there any guarantees of atomicity and visibility of read-write operations on IORefs, like Java have for volatile variables?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4291 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150802/7d2d1d06/attachment.bin>


More information about the Haskell-Cafe mailing list