packages feed

SafeSemaphore 0.10.0 → 0.10.1

raw patch · 4 files changed

+18/−11 lines, 4 files

Files

SafeSemaphore.cabal view
@@ -1,5 +1,5 @@ Name:                SafeSemaphore-Version:             0.10.0+Version:             0.10.1 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/MSemN.lhs view
@@ -37,7 +37,7 @@ >     ) where >  > import Prelude( Integral,Eq,IO,Int,Integer,Maybe(Just,Nothing),Num((+),(-)),Bool(False,True)->               , return,id,const,fmap,snd,maybe,seq+>               , return,const,fmap,snd,maybe,seq >               , (.),(<=),($),($!) ) > import Control.Concurrent.MVar( MVar >                               , withMVar,modifyMVar,modifyMVar_,newMVar
src/Control/Concurrent/MSemN2.hs view
@@ -36,7 +36,7 @@     ) where  import Prelude( Integral,Eq,IO,Int,Integer,Maybe(Just,Nothing),Num((+),(-)),Bool(False,True)-              , return,id,const,fmap,snd,seq+              , return,const,fmap,snd,seq               , (.),(<=),($),($!) ) import Control.Concurrent.MVar( MVar                               , withMVar,modifyMVar,newMVar
tests/TestKillSem.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {- some output from log of "cabal test", three old modules fail, three new modules pass:  Test SampleVar@@ -96,7 +97,9 @@ import Control.Concurrent.MVar import Test.HUnit import System.Exit+#if !MIN_VERSION_base(4,7,0) import Control.Concurrent.SampleVar+#endif import Control.Concurrent.MSampleVar as MSV import System.Timeout @@ -114,11 +117,11 @@  -- True if test passed, False if test failed -- This expects FIFO semantics for the waiters-testSem :: Integral n +testSem :: Integral n         => String-        -> (n -> IO a) -        -> (a->IO ()) -        -> (a -> IO ()) +        -> (n -> IO a)+        -> (a->IO ())+        -> (a -> IO ())         -> IO Bool testSem name new wait signal = do   putStrLn ("\n\nTest "++ name)@@ -181,11 +184,11 @@  -- True if test passed, False if test failed -- This does not expect FIFO semantics for the waiters, uses getValue instead-testSSem :: Integral n +testSSem :: Integral n         => String-        -> (n -> IO a) -        -> (a->IO ()) -        -> (a -> IO ()) +        -> (n -> IO a)+        -> (a->IO ())+        -> (a -> IO ())         -> (a -> IO Int)         -> IO Bool testSSem name new wait signal getValue = do@@ -226,7 +229,11 @@   putStrLn $ "Final Value "++show r   return (r==0) +#if !MIN_VERSION_base(4,7,0) testOldSV = test $ testSV "SampleVar" newEmptySampleVar readSampleVar writeSampleVar+#else+testOldSV = test $ putStrLn "Cannot test SampleVar on GHC 7.8 because it was removed" >> return False+#endif testNewSV = test $ testSV "MSampleVar" newEmptySV readSV writeSV  testsQ = TestList . (testOldSV:) . map test $