stm-io-hooks 0.1.0 → 0.2.0
raw patch · 4 files changed
+28/−27 lines, 4 filesdep ~arraydep ~basedep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: array, base, containers, mtl, stm
API changes (from Hackage documentation)
- Control.Concurrent.AdvSTM: unsafeOnRetry :: (MonadAdvSTM m) => IO () -> m ()
- Control.Concurrent.AdvSTM: unsafeRetryWith :: (Monad m, MonadAdvSTM m) => IO () -> m b
- Control.Monad.AdvSTM: unsafeOnRetry :: (MonadAdvSTM m) => IO () -> m ()
+ Control.Concurrent.AdvSTM: onRetry :: (MonadAdvSTM m) => IO () -> m ()
+ Control.Concurrent.AdvSTM: retryWith :: (Monad m, MonadAdvSTM m) => IO () -> m b
+ Control.Monad.AdvSTM: onRetry :: (MonadAdvSTM m) => IO () -> m ()
Files
- Control/Concurrent/AdvSTM.hs +6/−6
- Control/Monad/AdvSTM.hs +7/−7
- Control/Monad/AdvSTM/Class.hs +6/−6
- stm-io-hooks.cabal +9/−8
Control/Concurrent/AdvSTM.hs view
@@ -18,7 +18,7 @@ module Control.Concurrent.AdvSTM( -- * Class MonadAdvSTM MonadAdvSTM( onCommit- , unsafeOnRetry+ , onRetry , orElse , retry , check@@ -34,7 +34,7 @@ -- * Monad AdvSTM , AdvSTM- , unsafeRetryWith+ , retryWith , atomically , unsafeIOToAdvSTM , debugAdvSTM@@ -45,7 +45,7 @@ import Control.Monad.AdvSTM.Def(AdvSTM(..),Env(..),TVarValue(..)) import Control.Monad.AdvSTM.Class( MonadAdvSTM(..), TVar( TVar ), onCommitLock, currentTid, valueTVar ) -import Control.Exception(throw,catch,SomeException,fromException,try,block,unblock,Deadlock(..)) +import Control.Exception(throw,catch,SomeException,fromException,try,block,Deadlock(..)) import Control.Monad(mplus,when,liftM,ap,unless) import Control.Monad.Reader(MonadReader(..),ReaderT,runReaderT,lift,asks) import Control.Concurrent(threadDelay,forkIO,ThreadId,myThreadId)@@ -68,7 +68,7 @@ commitFun <- liftAdv $ STVar.readTVar commitVar liftAdv $ STVar.writeTVar commitVar $ commitFun . (ioaction >>) - unsafeOnRetry ioaction = do+ onRetry ioaction = do retryVar <- AdvSTM $ asks retryMVar liftAdv . unsafeIOToSTM $ do may'retryFun <- tryTakeMVar retryVar@@ -155,8 +155,8 @@ -- | Adds the IO action to the retry queue and then retries the transaction-unsafeRetryWith :: (Monad m, MonadAdvSTM m) => IO () -> m b-unsafeRetryWith io = unsafeOnRetry io >> retry+retryWith :: (Monad m, MonadAdvSTM m) => IO () -> m b+retryWith io = onRetry io >> retry
Control/Monad/AdvSTM.hs view
@@ -21,11 +21,11 @@ import Control.Monad.AdvSTM.Def import Control.Monad.AdvSTM.Class -import Control.Exception(Exception)-import qualified Control.Concurrent.STM as S-import Control.Concurrent.STM.TVar(TVar) -import Control.Concurrent.STM.TMVar(TMVar) -import Control.Concurrent(MVar,ThreadId)-import Control.Monad(Monad,MonadPlus)-import Control.Monad.Reader(MonadReader,ReaderT)+-- import Control.Exception(Exception)+-- import qualified Control.Concurrent.STM as S+-- import Control.Concurrent.STM.TVar(TVar) +-- import Control.Concurrent.STM.TMVar(TMVar) +-- import Control.Concurrent(MVar,ThreadId)+-- import Control.Monad(Monad,MonadPlus)+-- import Control.Monad.Reader(MonadReader,ReaderT)
Control/Monad/AdvSTM/Class.hs view
@@ -16,14 +16,14 @@ module Control.Monad.AdvSTM.Class( MonadAdvSTM(..), TVar(TVar), valueTVar, onCommitLock, currentTid ) where -import Control.Exception(Exception,Deadlock)+import Control.Exception(Exception) import qualified Control.Concurrent.STM as S import qualified Control.Concurrent.STM.TVar as OldTVar import qualified Control.Concurrent.STM.TMVar as OldTMVar import Control.Monad(Monad)-import Control.Monad.AdvSTM.Def(AdvSTM)+-- import Control.Monad.AdvSTM.Def(AdvSTM) import Control.Concurrent( ThreadId )-import GHC.Conc( unsafeIOToSTM )+--import GHC.Conc( unsafeIOToSTM ) -- import {-# SOURCE #-} Control.Concurrent.AdvSTM.TVar @@ -47,7 +47,7 @@ -- the TVars will be restored. -- -- * Accessing a modified TVar within the onCommit action will cause a- -- 'Deadlock' exception to be thrown. + -- Deadlock exception to be thrown. -- -- As a general rule, 'onCommit' should -- only be used for \"real\" (i.e. without atomic blocks) IO actions and is certainly@@ -68,13 +68,13 @@ -- -- Uses 'unsafeIOToSTM' to fork a helper thread that runs the retry -- actions. - unsafeOnRetry :: IO () -- ^ IO action that will be run on retry the transaction.+ onRetry :: IO () -- ^ IO action that will be run on retry the transaction. -> m () -- | See 'S.orElse' orElse :: m a -> m a -> m a - -- | Runs any IO actions added by 'unsafeOnRetry' and then retries the+ -- | Runs any IO actions added by 'onRetry' and then retries the -- transaction. retry :: m a
stm-io-hooks.cabal view
@@ -15,13 +15,14 @@ . Note: Part of this library uses code from the Haskell Wiki (see <http://haskell.org/haskellwiki/?title=New_monads/MonadAdvSTM>).+ Category: Concurrency Author: Peter Robinson 2009, Chris Kuklewicz 2006-Maintainer: Peter Robinson <robinson@ecs.tuwien.ac.at>+Maintainer: Peter Robinson <thaldyron@gmail.com> License: BSD3 License-file: LICENSE--- Homepage: http://darcs.monoid.at/stm-io-hooks-Version: 0.1.0+Homepage: http://darcs.monoid.at/stm-io-hooks+Version: 0.2.0 Build-type: Simple Cabal-Version: >= 1.2.3@@ -38,11 +39,11 @@ ,Control.Monad.AdvSTM.Class -- TODO: add Sample module! - build-depends: base >= 4.0.0.0- ,stm >= 2.1.1.2- ,array- ,containers >= 0.2.0.0- ,mtl >= 1.1.0.2+ build-depends: base >= 4.0.0.0 && < 4.1+ ,stm >= 2.1.1.2 && < 2.2+ ,array >= 0.2.0.0 && < 0.3+ ,containers >= 0.2.0.0 && < 0.3+ ,mtl >= 1.1.0.2 && < 1.2 extensions: MultiParamTypeClasses ,FunctionalDependencies