3 ms·
GHC, at least, uses the same implementation for IORef and STRef: http://hackage.haskell.org/package/base-4.3.1.0/docs/src/GHC-IORef.html#IORef http://hackage.ha
by eschew 12y ago
GHC, at least, uses the same implementation for IORef and STRef: http://hackage.haskell.org/package/base-4.3.1.0/docs/src/GHC-IORef.html#IORef http://hackage.haskell.org/package/base-4.3.1.0/docs/src/GHC...
Poking through GHC's runtime source, I see a writer barrier but no locking -- did I miss something?
- IsTom 12y agoLooking deeper you're right, it seems to use atomic CAS operations. Still mutable data is bad for GC and optimization pass (can't share expressions etc.)