Atomic compare and swap for IORefs and STRefs.
Documentation
atomicModifyIORefCAS :: IORef a -> (a -> (a, b)) -> IO bSource
A drop-in replacement for atomicModifyIORefCAS
that
optimistically attempts to compute the new value and CAS it into
place without introducing new thunks or locking anything. Note
that this is STRICTer than its standard counterpart and will only
place evaluated (WHNF) values in the IORef.
atomicModifyIORefCAS_ :: IORef t -> (t -> t) -> IO ()Source
A simpler version that modifies the state but does not return anything.