packages feed

stm 2.4.2 → 2.4.3

raw patch · 7 files changed

+112/−84 lines, 7 filesdep ~arraydep ~basenew-uploader

Dependency ranges changed: array, base

Files

Control/Concurrent/STM/TBQueue.hs view
@@ -38,6 +38,7 @@ 	writeTBQueue,         unGetTBQueue,         isEmptyTBQueue,+        isFullTBQueue,   ) where  import Data.Typeable@@ -177,3 +178,15 @@              case ys of                [] -> return True                _  -> return False++-- |Returns 'True' if the supplied 'TBQueue' is full.+isFullTBQueue :: TBQueue a -> STM Bool+isFullTBQueue (TBQueue rsize _read wsize _write) = do+  w <- readTVar wsize+  if (w > 0)+     then return False+     else do+         r <- readTVar rsize+         if (r > 0)+            then return False+            else return True
Control/Concurrent/STM/TChan.hs view
@@ -31,6 +31,7 @@ 	newBroadcastTChan, 	newBroadcastTChanIO,         dupTChan,+        cloneTChan,          -- ** Reading and writing 	readTChan,@@ -39,8 +40,7 @@ 	tryPeekTChan, 	writeTChan,         unGetTChan,-        isEmptyTChan,-        cloneTChan+        isEmptyTChan #endif   ) where @@ -105,9 +105,8 @@ -- | @IO@ version of 'newBroadcastTChan'. newBroadcastTChanIO :: IO (TChan a) newBroadcastTChanIO = do-    dummy_hole <- newTVarIO TNil     write_hole <- newTVarIO TNil-    read <- newTVarIO dummy_hole+    read <- newTVarIO (error "reading from a TChan created by newBroadcastTChanIO; use dupTChan first")     write <- newTVarIO write_hole     return (TChan read write) 
Control/Concurrent/STM/TSem.hs view
@@ -20,7 +20,6 @@ import Control.Concurrent.STM import Control.Monad import Data.Typeable-import Control.Exception  -- | 'TSem' is a transactional semaphore.  It holds a certain number -- of units, and units may be acquired or released by 'waitTSem' and
Control/Concurrent/STM/TVar.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-}  #if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Trustworthy #-}@@ -30,21 +30,19 @@ 	modifyTVar', 	swapTVar, #ifdef __GLASGOW_HASKELL__-	registerDelay+        registerDelay, #endif+        mkWeakTVar   ) where  #ifdef __GLASGOW_HASKELL__+import GHC.Base import GHC.Conc+import GHC.Weak #else import Control.Sequential.STM #endif -#if ! (MIN_VERSION_base(4,2,0))-readTVarIO = atomically . readTVar-#endif-- -- Like 'modifyIORef' but for 'TVar'. -- | Mutate the contents of a 'TVar'. /N.B./, this version is -- non-strict.@@ -72,3 +70,9 @@     return old {-# INLINE swapTVar #-} ++-- | Make a 'Weak' pointer to a 'TVar', using the second argument as+-- a finalizer to run when 'TVar' is garbage-collected+mkWeakTVar :: TVar a -> IO () -> IO (Weak (TVar a))+mkWeakTVar t@(TVar t#) f = IO $ \s ->+    case mkWeak# t# t f s of (# s1, w #) -> (# s1, Weak w #)
Control/Sequential/STM.hs view
@@ -40,35 +40,17 @@ 	x <- m r 	unSTM (k x) r -#ifdef BASE4 atomically :: STM a -> IO a atomically (STM m) = do     r <- newIORef (return ())     m r `onException` do 	rollback <- readIORef r 	rollback-#else-atomically :: STM a -> IO a-atomically (STM m) = do-    r <- newIORef (return ())-    m r `catch` \ ex -> do-	rollback <- readIORef r-	rollback-	throw ex-#endif -#ifdef BASE4 throwSTM :: Exception e => e -> STM a-#else-throwSTM :: Exception -> STM a-#endif throwSTM = STM . const . throwIO -#ifdef BASE4 catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a-#else-catchSTM :: STM a -> (Exception -> STM a) -> STM a-#endif catchSTM (STM m) h = STM $ \ r -> do     old_rollback <- readIORef r     writeIORef r (return ())
+ changelog.md view
@@ -0,0 +1,38 @@+# Changelog for [`stm` package](http://hackage.haskell.org/package/stm)++## 2.4.3  *Mar 2014*++  * Update behaviour of `newBroadcastTChanIO` to match+    `newBroadcastTChan` in causing an error on a read from the+    broadcast channel++  * Add `mkWeakTVar`++  * Add `isFullTBQueue`++  * Fix `TChan` created via `newBroadcastTChanIO` to throw same+    exception on a `readTChan` as when created via `newBroadcastTChan`++  * Update to Cabal 1.10 format++## 2.4.2  *Nov 2012*++  * Add `Control.Concurrent.STM.TSem` (transactional semaphore)++  * Add Applicative/Alternative instances of STM for GHC <7.0++  * Throw proper exception when `readTChan` called on a broadcast `TChan`++## 2.4  *Jul 2012*++  * Add `Control.Concurrent.STM.TQueue` (a faster `TChan`)++  * Add `Control.Concurrent.STM.TBQueue` (a bounded channel based on `TQueue`)++  * Add `Eq` instance for `TChan`++  * Add `newBroadcastTChan` and `newBroadcastTChanIO`++  * Some performance improvements for `TChan`++  * Add `cloneTChan`
stm.cabal view
@@ -1,62 +1,55 @@-name:		stm-version:        2.4.2-license:	BSD3-license-file:	LICENSE-maintainer:	libraries@haskell.org-synopsis:	Software Transactional Memory+name:           stm+version:        2.4.3+license:        BSD3+license-file:   LICENSE+maintainer:     libraries@haskell.org+bug-reports:    http://ghc.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29&keywords=stm+synopsis:       Software Transactional Memory category:       Concurrency-description:- A modular composable concurrency abstraction.- .- Changes in version 2.4.2- .- * Added "Control.Concurrent.STM.TSem" (transactional semaphore)- .- Changes in version 2.4.1- .- * Added Applicative/Alternative instances of STM for GHC <7.0- .- Changes in version 2.4- .- * Added "Control.Concurrent.STM.TQueue" (a faster @TChan@)- .- * Added "Control.Concurrent.STM.TBQueue" (a bounded channel based on @TQueue@)- .- * @TChan@ has an @Eq@ instances- .- * Added @newBroadcastTChan@ and @newBroadcastTChanIO@- .- * Some performance improvements for @TChan@- .- * Added @cloneTChan@-+description:    A modular composable concurrency abstraction. build-type:     Simple-cabal-version:  >=1.6+cabal-version:  >=1.10+tested-with:    GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1, GHC==6.12.3 +extra-source-files:+    changelog.md+ source-repository head     type:     git-    location: http://darcs.haskell.org/packages/stm.git/+    location: http://git.haskell.org/packages/stm.git -flag base4+source-repository this+    type:     git+    location: http://git.haskell.org/packages/stm.git+    tag:      stm-2.4.3-release  library-  exposed-modules:-    Control.Concurrent.STM-    Control.Concurrent.STM.TArray-    Control.Concurrent.STM.TVar-    Control.Concurrent.STM.TChan-    Control.Concurrent.STM.TMVar-    Control.Concurrent.STM.TQueue-    Control.Concurrent.STM.TBQueue-    Control.Concurrent.STM.TSem-    Control.Monad.STM-  other-modules:-    Control.Sequential.STM-  build-depends: base < 5, array-  if flag(base4)-    build-depends: base >=4-    cpp-options:   -DBASE4-  else-    build-depends: base <4-  if impl(ghc >= 6.10)-    build-depends: base >=4+    default-language: Haskell98+    other-extensions:+        CPP+        DeriveDataTypeable+        FlexibleInstances+        MagicHash+        MultiParamTypeClasses+        UnboxedTuples+    if impl(ghc >= 7.2)+        other-extensions: Trustworthy++    build-depends:+        base  >= 4.2 && < 4.8,+        array >= 0.3 && < 0.6++    exposed-modules:+        Control.Concurrent.STM+        Control.Concurrent.STM.TArray+        Control.Concurrent.STM.TVar+        Control.Concurrent.STM.TChan+        Control.Concurrent.STM.TMVar+        Control.Concurrent.STM.TQueue+        Control.Concurrent.STM.TBQueue+        Control.Concurrent.STM.TSem+        Control.Monad.STM+    other-modules:+        Control.Sequential.STM++    ghc-options: -Wall