SafeSemaphore 0.9.0 → 0.10.0
raw patch · 3 files changed
+20/−5 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- SafeSemaphore.cabal +1/−1
- src/Control/Concurrent/MSampleVar.hs +9/−3
- src/Control/Concurrent/STM/SSemInternals.hs +10/−1
SafeSemaphore.cabal view
@@ -1,5 +1,5 @@ Name: SafeSemaphore-Version: 0.9.0+Version: 0.10.0 Synopsis: Much safer replacement for QSemN, QSem, and SampleVar Description: This provides a much safer semaphore than the QSem, QSemN, SampleVar in base. Those base modules are not exception safe and can be broken by killThread.
src/Control/Concurrent/MSampleVar.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveDataTypeable, CPP #-} -- -- Module : Control.Concurrent.MSampleVar -- Copyright : (c) Chris Kuklewicz 2011@@ -30,7 +30,7 @@ import Control.Monad(void,join) import Control.Concurrent.MVar(MVar,newMVar,newEmptyMVar,tryTakeMVar,takeMVar,putMVar,withMVar,isEmptyMVar) import Control.Exception(mask_)-import Data.Typeable(Typeable1(typeOf1),mkTyCon,mkTyConApp)+import Data.Typeable -- | -- Sample variables are slightly different from a normal 'MVar':@@ -60,11 +60,17 @@ -- value possible while still guaranteeing progress. data MSampleVar a = MSampleVar { readQueue :: MVar () , lockedStore :: MVar (MVar a) }- deriving (Eq)+ deriving ( Eq+#if __GLASGOW_HASKELL__ >= 707+ , Typeable+#endif+ ) +#if __GLASGOW_HASKELL__ < 707 instance Typeable1 MSampleVar where typeOf1 _ = mkTyConApp tc [] where tc = mkTyCon "MSampleVar"+#endif -- | 'newEmptySV' allocates a new MSampleVar in an empty state. No futher
src/Control/Concurrent/STM/SSemInternals.hs view
@@ -20,8 +20,17 @@ import Control.Concurrent.STM.TVar(TVar) import Data.Typeable(Typeable) -- Typeable(typeOf),TyCon,mkTyCon,mkTyConApp) +#if __GLASGOW_HASKELL__ < 707 #include "Typeable.h"+#endif -newtype SSem = SSem (TVar Int) deriving (Eq)+newtype SSem = SSem (TVar Int)+ deriving ( Eq+#if __GLASGOW_HASKELL__ >= 707+ , Typeable+#endif+ ) +#if __GLASGOW_HASKELL__ < 707 INSTANCE_TYPEABLE0(SSem,semTc,"SSem")+#endif