packages feed

IORefCAS 0.1.0.1 → 0.2

raw patch · 2 files changed

+22/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.CAS: casSTRef :: STRef s a -> a -> a -> ST s (Bool, a)
- Data.CAS: instance CASable CASRef a
- Data.CAS: atomicModifyIORefCAS_ :: IORef t -> (t -> t) -> IO ()
+ Data.CAS: atomicModifyIORefCAS_ :: IORef a -> (a -> a) -> IO ()

Files

Data/CAS.hs view
@@ -1,15 +1,26 @@-{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns, MagicHash,+{-# LANGUAGE CPP, MagicHash, UnboxedTuples, BangPatterns, MagicHash,     TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-}  -- | Atomic compare and swap for IORefs and STRefs. module Data.CAS - ( casSTRef, casIORef, ptrEq,+ ( +  -- Not currently provided by Fake.hs:+  -- casSTRef, +   casIORef, ptrEq,    atomicModifyIORefCAS, atomicModifyIORefCAS_,     -- * Generic interface: for interoperation with `Fake` and `Foreign` alternative libraries.    CASRef) where +#if __GLASGOW_HASKELL__ <= 702  /* Fix to casMutVar introduced 2011.12.09 */++#warning "casMutVar is not included or is bugged in your GHC, falling back to Fake version."++import Data.CAS.Internal.Fake++#else+ import Data.CAS.Internal.Class import GHC.IO import GHC.IORef@@ -61,7 +72,7 @@ -- | 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+--   that this is more STRICT than its standard counterpart and will only --   place evaluated (WHNF) values in the IORef. atomicModifyIORefCAS :: IORef a -> (a -> (a,b)) -> IO b atomicModifyIORefCAS ref fn = do@@ -97,3 +108,5 @@       else loop val (tries-1)    atomicModifyIORef_ ref fn = atomicModifyIORef ref (\ x -> (fn x, ())) -- </duplicated code>++#endif
IORefCAS.cabal view
@@ -1,5 +1,5 @@ Name:                IORefCAS-Version:             0.1.0.1+Version:             0.2 License:             BSD3 License-file:        LICENSE Author:              Adam C. Foltzer, Ryan Newton@@ -13,6 +13,7 @@ -- 0.0.1.1 -- minor bump to include README -- 0.0.1.2 -- Egad, super minor update. -- 0.1.0.1 -- Include ptrEq in Data.CAS+-- 0.2     -- Bumped for #if policy to test for GHC >7.2.  Removed casSTRef from the API for now.  Synopsis: Atomic compare and swap for IORefs and STRefs. @@ -40,6 +41,10 @@                      Data.CAS.Internal.Class,                      Data.CAS.Internal.Fake,                      Data.CAS.Internal.Foreign+  -- I have observed problems on both Mac and Linux with 7.0.x.  [2011.12.23]+  -- Thus for now we require GHC 7.2 or greater (base 4.4 or greater).+  -- Namely Test.hs observes CAS failing half the time even with only ONE thread.+  -- This is probably a tricky pointer-equality related problem.   build-depends:     base >= 4.4.0.0 && < 5,                      ghc-prim, bits-atomic