IORefCAS-0.2: Atomic compare and swap for IORefs and STRefs.
After GHC 7.2 a new `casMutVar#` primop became available, but was not yet exposed in Data.IORef. This package fills that gap until such a time as Data.IORef obsoletes it.
Further, in addition to exposing native Haskell CAS operations, this
package contains "mockups" that imititate the same functionality
using either atomicModifyIORef and unsafe pointer equality (in
Data.CAS.Fake
) or using foreign functions (Data.CAS.Foreign
).
These alternatives are useful for debugging.
Note that the foreign option does not operate on IORefs and so is
directly interchangeable with CAS
and Fake
only if
the interface in Class
is used.
Modules