projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use explicit language extensions & remove extension fields from base.cabal
[ghc-base.git]
/
Control
/
Concurrent
/
SampleVar.hs
diff --git
a/Control/Concurrent/SampleVar.hs
b/Control/Concurrent/SampleVar.hs
index
c66241e
..
ca68a38
100644
(file)
--- a/
Control/Concurrent/SampleVar.hs
+++ b/
Control/Concurrent/SampleVar.hs
@@
-1,3
+1,5
@@
+{-# LANGUAGE CPP #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : Control.Concurrent.SampleVar
-----------------------------------------------------------------------------
-- |
-- Module : Control.Concurrent.SampleVar
@@
-34,6
+36,10
@@
import Control.Exception ( mask_ )
import Data.Functor ( (<$>) )
import Data.Functor ( (<$>) )
+import Data.Typeable
+
+#include "Typeable.h"
+
-- |
-- Sample variables are slightly different from a normal 'MVar':
--
-- |
-- Sample variables are slightly different from a normal 'MVar':
--
@@
-58,6
+64,8
@@
newtype SampleVar a = SampleVar ( MVar ( Int -- 1 == full
)
deriving (Eq)
)
deriving (Eq)
+INSTANCE_TYPEABLE1(SampleVar,sampleVarTc,"SampleVar")
+
-- |Build a new, empty, 'SampleVar'
newEmptySampleVar :: IO (SampleVar a)
newEmptySampleVar = do
-- |Build a new, empty, 'SampleVar'
newEmptySampleVar :: IO (SampleVar a)
newEmptySampleVar = do
@@
-120,5
+128,5
@@
writeSampleVar (SampleVar svar) v = mask_ $ do
isEmptySampleVar :: SampleVar a -> IO Bool
isEmptySampleVar (SampleVar svar) = do
(readers, _) <- readMVar svar
isEmptySampleVar :: SampleVar a -> IO Bool
isEmptySampleVar (SampleVar svar) = do
(readers, _) <- readMVar svar
- return (readers == 0)
+ return (readers <= 0)