
7 May
2012
7 May
'12
9:20 p.m.
On 5/7/12 11:25 AM, Ivan Tomac wrote:
One assumption that has been made is that IORef reads and writes are atomic. In other words that if there are two or more concurrent writes to the same IORef, one of them will successfully write its data to it. I have not been able to find exact semantics of IORefs though I've asked in #haskell and others have suggested that the assumption is valid.
I'm sure reads and writes are atomic (for safety reasons), though I don't know if that's formally specified anywhere. It should be though. If you're paranoid, you can always use atomicModifyIORef which guarantees atomicity. Albeit, that's more powerful (and hence slower) than you need for plain reads and writes. -- Live well, ~wren